:root {
    --gold: #d4af37;
    --gold-bright: #f9d71c;
    --bg-dark: #0a0e14;
    --sidebar-bg: #0d121b;
    --card-bg: #151c26;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --accent: #1e2a3a;
    --border: #2a3441;
    --admin-gold: #ffc107;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.wiki-body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

h1, h2, h3, .cinzel {
    font-family: 'Cinzel', serif;
}

.wiki-wrapper {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.wiki-sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    flex-shrink: 0;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.wiki-logo {
    width: 80px;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.3));
}

.sidebar-header h1 {
    font-size: 1.25rem;
    color: var(--gold);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.5rem;
}

.sidebar-nav a {
    display: block;
    padding: 0.8rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

.sidebar-nav a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.sidebar-nav li.active a,
.sidebar-nav a:hover {
    background-color: var(--accent);
    color: var(--gold-bright);
}

.nav-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border), transparent);
    margin: 1.5rem 0;
}

.admin-link {
    color: var(--admin-gold) !important;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 2rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

.back-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--gold);
    text-decoration: none;
    font-weight: 600;
}

/* Content Area */
.wiki-content {
    flex-grow: 1;
    overflow-y: auto;
    background: radial-gradient(circle at 50% 50%, #1a222c 0%, #0a0e14 100%);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    background-color: rgba(13, 18, 27, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.breadcrumb {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-family: 'Cinzel', serif;
}

.badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-badge {
    background-color: rgba(255, 193, 7, 0.15);
    color: var(--admin-gold);
    border: 1px solid var(--admin-gold);
}

.public-badge {
    background-color: rgba(160, 160, 160, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--text-muted);
}

/* Page Container */
.page-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 4rem 3rem;
}

/* Sections */
.wiki-section-title {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--gold);
    border-bottom: 2px solid var(--gold);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.wiki-intro {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
}

/* Grid Layouts */
.wiki-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.wiki-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.wiki-card:hover {
    transform: translateY(-5px);
    border-color: var(--gold);
}

.card-image-box {
    height: 180px;
    background-color: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.card-image-box img {
    max-width: 100%;
    max-height: 100%;
    transition: opacity 0.3s ease;
}

.card-type-label {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.7rem;
    background: rgba(0,0,0,0.7);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--gold);
}

.card-body {
    padding: 1.5rem;
}

.card-body h3 {
    margin-bottom: 0.5rem;
    color: var(--gold);
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 1rem;
}

.stat-tag {
    font-size: 0.75rem;
    background: var(--accent);
    padding: 4px 8px;
    border-radius: 4px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Tables */
.wiki-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
}

.wiki-table th, .wiki-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.wiki-table th {
    background: var(--accent);
    color: var(--gold);
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.wiki-table tr:hover {
    background: rgba(255,255,255,0.03);
}

/* Rarity Colors */
.rarity-common { color: #ffffff; }
.rarity-uncommon { color: #1eff00; }
.rarity-rare { color: #0070dd; }
.rarity-epic { color: #a335ee; }
.rarity-legendary { color: #ff8000; }

/* Admin Overlay */
.admin-editable {
    position: relative;
    border: 1px dashed transparent;
    transition: all 0.3s;
}

.admin-editable:hover {
    border-color: var(--admin-gold);
    background: rgba(255, 193, 7, 0.05);
}

.edit-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--admin-gold);
    color: #000;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.admin-editable:hover .edit-btn {
    display: flex;
}

/* Recent Changes Widget */
.recent-changes-list {
    list-style: none;
}

.recent-item {
    display: flex;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    transition: padding-left 0.3s ease;
}

.recent-item:hover {
    padding-left: 10px;
}

.recent-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    color: var(--gold);
}

.recent-info h4 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.recent-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.wiki-link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.8rem;
}

.wiki-link-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--gold-bright);
    border: 1px solid var(--border);
    background: rgba(30, 42, 58, 0.45);
    border-radius: 10px;
    min-height: 44px;
    padding: 0.65rem 0.9rem;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.wiki-link-card:hover {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.12);
    transform: translateY(-2px);
}

.wiki-inline-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.wiki-inline-links a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--gold-bright);
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(30, 42, 58, 0.45);
    padding: 0.28rem 0.7rem;
    font-size: 0.78rem;
    line-height: 1.25;
}

.wiki-inline-links a:hover {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.12);
}

@media (max-width: 980px) {
    .content-header {
        padding: 1rem 1.25rem;
    }

    .page-container {
        padding: 1.5rem 1rem;
    }

    .wiki-sidebar {
        width: 220px;
        padding: 1.2rem 0.9rem;
    }

    .tribe-card {
        flex-direction: column !important;
    }

    .tribe-card .tribe-image {
        width: 100% !important;
        height: 220px !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border);
    }

    .tribe-card .card-body {
        width: 100% !important;
        padding: 1.2rem !important;
    }
}
