/* ===========================
   CSS VARIABLES & RESET
   =========================== */

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

:root {
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --secondary: #10b981;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    --accent: #8b5cf6;
    --navbar-bg: #ffffff;
    --gradient: linear-gradient(135deg, #8b5cf6 0%, #10b981 100%);
    --code-bg: #1e1e1e;
    --code-text: #d4d4d4;
    --keyword-color: #f5c842;
    --keyword-bg: rgba(245, 200, 66, 0.1);
}

[data-theme="dark"] {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-card: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border: #374151;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
    --navbar-bg: #111827;
    --code-bg: #0f172a;
    --code-text: #cbd5e1;
    --keyword-color: #f5c842;
    --keyword-bg: rgba(245, 200, 66, 0.15);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

/* ===========================
   HERO SECTION
   =========================== */

.hero {
    background: var(--gradient);
    padding: 4rem 2rem;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
    border-bottom: 2px solid var(--border);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hero-h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.hero-para {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.hero-stats span {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
}

[data-theme="dark"] .hero {
    background: linear-gradient(to right, #111827, #1f2937);
}

[data-theme="dark"] .hero-para {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .hero-h1 {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .hero-stats span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border: 1px solid #7c3aed;
}

/* ===========================
   MAIN CONTAINER
   =========================== */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* ===========================
   DIALECT SELECTOR
   =========================== */

.dialect-selector-wrapper {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
    border: 2px solid var(--border);
    box-shadow: 0 4px 20px var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.dialect-selector-wrapper label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.1rem;
}

.dialect-selector-wrapper label i {
    color: var(--primary);
}

.dialect-select {
    flex: 1;
    min-width: 250px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
}

.dialect-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* ===========================
   CHEATSHEET LAYOUT
   =========================== */

.cheatsheet-layout {
    display: flex;
    gap: 25px;
    min-height: 600px;
}

/* Sidebar */
.cheatsheet-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: 16px;
    border: 2px solid var(--border);
    padding: 20px 0;
    height: fit-content;
    position: sticky;
    top: 100px;
    box-shadow: 0 4px 20px var(--shadow);
}

.nav-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 20px;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

.nav-btn.active {
    color: var(--primary);
    border-left-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    font-weight: 600;
}

/* Main Content */
.cheatsheet-main {
    flex: 1;
    background: var(--bg-card);
    border-radius: 16px;
    border: 2px solid var(--border);
    padding: 25px;
    box-shadow: 0 4px 20px var(--shadow);
}

.cheatsheet-header {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.cheatsheet-header .dialect-tag {
    font-size: 0.9rem;
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 500;
}

/* Sections */
.section {
    margin-bottom: 35px;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.section-heading .diamond {
    color: var(--primary);
    font-size: 0.8rem;
}

.section-heading .sh-label {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

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

/* Entry Cards */
.entry {
    display: grid;
    grid-template-columns: 1fr auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.entry:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow);
}

.entry-body {
    padding: 16px 20px;
    min-width: 0;
}

.entry-body pre {
    margin: 0 0 8px;
    font-size: 13.5px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
    font-family: 'Fira Code', 'Consolas', monospace;
}

.entry-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.entry-copy {
    display: flex;
    align-items: center;
    padding: 0 15px;
    border-left: 1px solid var(--border);
    flex-shrink: 0;
}

.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.3rem;
    padding: 8px 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
    line-height: 1;
    font-family: monospace;
}

.copy-btn:hover {
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    transform: scale(1.1);
}

.copy-btn.copied {
    color: #10b981;
}

/* Syntax Highlighting */
.kw {
    color: var(--keyword-color);
    font-weight: 600;
    background: var(--keyword-bg);
    padding: 2px 4px;
    border-radius: 4px;
}

/* Snippet Count */
#snippet-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

/* ===========================
   NOTIFICATION
   =========================== */

.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 16px 24px;
    background: var(--gradient);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
    transform: translateX(400px);
    transition: transform 0.4s ease;
    z-index: 1000;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.notification.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.notification.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* ===========================
   ANIMATIONS
   =========================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ===========================
   RESPONSIVE DESIGN
   =========================== */

@media (max-width: 1024px) {
    .cheatsheet-layout {
        flex-direction: column;
    }
    
    .cheatsheet-sidebar {
        width: 100%;
        position: static;
        display: flex;
        flex-wrap: wrap;
        padding: 10px;
    }
    
    .nav-btn {
        width: auto;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 10px 15px;
    }
    
    .nav-btn.active {
        border-left-color: transparent;
        border-bottom-color: var(--primary);
    }
}

@media (max-width: 768px) {
    .hero-h1 {
        font-size: 2rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .hero-para {
        font-size: 1rem;
    }

    .hero-stats {
        gap: 1rem;
    }

    .hero-stats span {
        padding: 6px 15px;
        font-size: 0.9rem;
    }

    .container {
        padding: 2rem 1rem;
    }

    .dialect-selector-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .dialect-select {
        width: 100%;
    }

    .cheatsheet-header {
        font-size: 1.5rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .entry {
        grid-template-columns: 1fr;
    }
    
    .entry-copy {
        border-left: none;
        border-top: 1px solid var(--border);
        justify-content: flex-end;
        padding: 10px 15px;
    }

    .cookie-buttons {
        flex-direction: column;
    }

    .cookie-btn {
        width: 100%;
        justify-content: center;
    }

    .cookie-settings-buttons {
        flex-direction: column;
    }

    .cookie-settings-btn {
        width: 100%;
        justify-content: center;
    }
    
    .notification {
        top: auto;
        bottom: 20px;
        right: 20px;
        left: 20px;
        width: calc(100% - 40px);
        transform: translateY(100px);
    }

    .notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1.5rem 1rem;
    }

    .cheatsheet-main {
        padding: 15px;
    }

    .section-heading .sh-label {
        font-size: 1rem;
    }

    .entry-body {
        padding: 12px 15px;
    }

    .entry-body pre {
        font-size: 12px;
    }

    .entry-desc {
        font-size: 0.85rem;
    }

    .nav-btn {
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    .cheatsheet-header {
        font-size: 1.3rem;
    }
}