/* ============================================================
   Enchantment Guide - Complete Reference
   Dark Theme Modern Design
   ============================================================ */

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #16162a;
    --bg-tertiary: #1e1e3a;
    --bg-card: #1a1a2e;
    --bg-hover: #222244;
    --bg-active: #2a2a55;
    
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0c0;
    --text-tertiary: #707090;
    --text-muted: #505070;
    
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #a78bfa;
    --accent-glow: rgba(99, 102, 241, 0.3);
    
    --border-color: #2a2a45;
    --border-light: #333355;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    
    --sidebar-width: 260px;
    --sidebar-collapsed: 60px;
    --header-height: 64px;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ========== LAYOUT ========== */
.app {
    display: flex;
    min-height: 100vh;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease, width 0.3s ease;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-link span:not(.count-badge),
.sidebar.collapsed .nav-label {
    display: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .nav-link i {
    margin: 0;
    font-size: 1.2rem;
}

.sidebar.collapsed .count-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.6rem;
    padding: 1px 4px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.logo i {
    font-size: 1.5rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 2px;
    position: relative;
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.nav-link.active .count-badge {
    background: rgba(255,255,255,0.2);
    color: white;
}

.count-badge {
    margin-left: auto;
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    min-width: 28px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.lang-switch {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 4px;
}

.lang-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.lang-btn.active {
    background: var(--accent-primary);
    color: white;
}

.lang-btn:hover:not(.active) {
    color: var(--text-primary);
}

/* ========== SIDEBAR OVERLAY ========== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* ========== HEADER ========== */
.main-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.search-container {
    flex: 1;
    max-width: 600px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: none;
}

.search-clear.visible {
    display: block;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.view-toggle {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 2px;
}

.view-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.view-btn.active {
    background: var(--accent-primary);
    color: white;
}

/* ========== FILTERS ========== */
.filters-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    gap: 16px;
    overflow-x: auto;
}

.filter-group {
    display: flex;
    gap: 8px;
}

.filter-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.filter-chip i {
    font-size: 0.75rem;
}

.filter-chip:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.sort-select {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.sort-select:focus {
    border-color: var(--accent-primary);
}

/* ========== CONTENT AREA ========== */
.content-area {
    flex: 1;
    padding: 0 24px 24px;
}

/* ========== RESULTS HEADER ========== */
.results-header {
    margin-bottom: 20px;
}

.results-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.results-count {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 1rem;
}

/* ========== ENCHANTMENTS GRID ========== */
.enchantments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.enchantments-grid.list-view {
    grid-template-columns: 1fr;
}

.enchantments-grid.list-view .enchantment-card {
    flex-direction: row;
    align-items: center;
}

.enchantments-grid.list-view .card-header {
    flex: 1;
}

.enchantments-grid.list-view .card-body {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 2;
}

.enchantments-grid.list-view .card-description {
    flex: 1;
    margin: 0;
    -webkit-line-clamp: 1;
}

.enchantments-grid.list-view .card-meta {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 200px;
}

/* ========== ENCHANTMENT CARD ========== */
.enchantment-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.enchantment-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 4px 20px var(--accent-glow);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.card-level {
    background: var(--accent-primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.card-category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--accent-tertiary);
    font-weight: 500;
    margin-top: 2px;
}

.card-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.meta-tag i {
    font-size: 0.65rem;
}

.meta-tag.trigger {
    color: var(--info);
    background: rgba(59, 130, 246, 0.1);
}

.meta-tag.items {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

/* ========== PAGINATION ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
    padding-bottom: 24px;
}

.page-btn {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.page-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.page-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ========== DETAIL VIEW ========== */
.detail-view {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 24px;
    transition: all 0.2s;
    font-family: inherit;
}

.back-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.detail-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.detail-hero {
    padding: 40px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-bottom: 1px solid var(--border-color);
}

.detail-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.detail-subtitle {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.detail-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-lg);
    font-size: 0.8rem;
    font-weight: 600;
}

.detail-badge.level {
    background: var(--accent-primary);
    color: white;
}

.detail-badge.category {
    background: rgba(167, 139, 250, 0.15);
    color: var(--accent-tertiary);
}

.detail-badge.trigger {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.detail-description {
    padding: 40px;
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.detail-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0;
}

.detail-section {
    padding: 32px;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.detail-section:last-child {
    border-right: none;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.section-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.info-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.info-value.enabled {
    color: var(--success);
}

.info-value.disabled {
    color: var(--danger);
}

.items-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.item-tag {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.actions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.action-tag {
    padding: 6px 12px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    color: var(--accent-primary);
    font-weight: 500;
}

/* ========== STATS VIEW ========== */
.stats-view {
    animation: fadeIn 0.3s ease;
}

.stats-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ========== NO RESULTS ========== */
.no-results {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.no-results i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.no-results p {
    font-size: 0.9rem;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .enchantments-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
    
    .filters-bar {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay.open {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .search-container {
        max-width: none;
    }
    
    .enchantments-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
    }
    
    .detail-sections {
        grid-template-columns: 1fr;
    }
    
    .detail-hero {
        padding: 24px;
    }
    
    .detail-title {
        font-size: 1.5rem;
    }
    
    .detail-section {
        border-right: none;
    }
}

@media (max-width: 480px) {
    .main-header {
        padding: 0 12px;
    }
    
    .content-area {
        padding: 0 12px 12px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
