/* ===== MODERN ANKI-PTSI THEME ===== */

:root {
    /* Nord Theme Inspired Palette - Refined for Web */
    --bg-main: #2e3440;
    --bg-card: #3b4252;
    --bg-card-hover: #434c5e;
    --text-primary: #eceff4;
    --text-secondary: #d8dee9;
    --text-muted: #4c566a;

    --accent-primary: #88c0d0;
    /* Frost Blue */
    --accent-secondary: #81a1c1;
    /* Darker Blue */
    --accent-success: #a3be8c;
    /* Aurora Green */
    --accent-warning: #ebcb8b;
    /* Aurora Yellow */
    --accent-danger: #bf616a;
    /* Aurora Red */

    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

:root.light-theme {
    /* Light Theme Palette - Enhanced Contrast */
    --bg-main: #f0f4f8;
    /* Softer light gray for main bg */
    --bg-card: #ffffff;
    /* Pure white for cards to pop out */
    --bg-card-hover: #ffffff;
    /* pure white on hover according to feedback */
    --text-primary: #1e293b;
    /* Dark slate for high contrast */
    --text-secondary: #475569;
    /* Medium slate for secondary text */
    --text-muted: #64748b;
    /* Muted slate */

    --accent-primary: #3b82f6;
    /* Vibrant blue for better contrast and modern look */
    --accent-secondary: #2563eb;

    /* Slightly stronger shadows for light mode */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}


/* ===================================================
   GLASS NAVBAR
   =================================================== */

.glass-navbar {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1000px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    background: rgba(46, 52, 64, 0.6);
    backdrop-filter: blur(12px) saturate(1.4);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

:root.light-theme .glass-navbar {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.glass-navbar:hover {
    background: rgba(46, 52, 64, 0.75);
    border-color: rgba(136, 192, 208, 0.3);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

:root.light-theme .glass-navbar:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(59, 130, 246, 0.3);
}

.glass-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    text-decoration: none;
}

.glass-brand img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.glass-nav-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.glass-nav-link {
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.glass-nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

:root.light-theme .glass-nav-link:hover {
    background: rgba(0, 0, 0, 0.05);
}

.glass-nav-link.active {
    color: var(--bg-main);
    background: var(--accent-primary);
    font-weight: 600;
}

:root.light-theme .glass-nav-link.active {
    color: var(--bg-card);
    /* White text on blue background */
}

:root.light-theme .glass-nav-link.active:hover {
    background: var(--accent-primary);
    /* Prevents the grey hover override */
    color: var(--bg-card);
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 50%;
}

.theme-toggle:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.theme-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
}

:root.light-theme .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Mobile responsive styles for glass navbar */
@media (max-width: 768px) {
    .glass-navbar {
        top: 0;
        width: 100%;
        max-width: none;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        padding: 0.75rem 1rem;
    }
}


/* ===================================================
   LANDING PAGE — Hero
   =================================================== */

.landing-hero {
    padding: 10rem 0 12rem;
    /* Increased padding */
    text-align: center;
    position: relative;
    overflow: hidden;
    /* Fallback for browsers without WebGL — matches the dark theme */
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-main) 100%);
    /* Smooth transition to the next section */
    -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
}

/* Hero content must sit above the iridescence canvas + overlay */
.landing-hero .hero-content {
    position: relative;
    z-index: 2;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    /* Glass effect with higher contrast */
    background: rgba(46, 52, 64, 0.6);
    /* Darker semi-transparent background */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(136, 192, 208, 0.3);
    /* Slightly more visible border */
    padding: 0.5rem 1.25rem;
    border-radius: 2rem;
    font-size: 0.95rem;
    /* Slightly larger text */
    color: var(--accent-primary);
    margin-bottom: 2rem;
    font-weight: 600;
    /* Bolder text */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    /* Stronger shadow */
}

:root.light-theme .hero-badge {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.landing-hero .hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    color: var(--text-primary);
    /* Brighter white */
    -webkit-text-fill-color: unset;
    background: none;
    -webkit-background-clip: unset;
    margin-bottom: 1.5rem;
    letter-spacing: -0.03em;
    line-height: 1.1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    /* Added subtle shadow */
}

:root.light-theme .hero-title {
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.5);
}

.hero-highlight {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    /* No shadow on gradient text */
}

.landing-hero .hero-subtitle {
    font-size: 1.35rem;
    /* Increased size */
    color: var(--text-primary);
    /* Pure white text */
    opacity: 1;
    /* Remove opacity */
    max-width: 700px;
    /* Slightly wider */
    margin: 0 auto 2.5rem;
    line-height: 1.6;
    font-weight: 500;
    /* Medium weight */
}

:root.light-theme .landing-hero .hero-subtitle {
    color: var(--text-secondary);
    text-shadow: none;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--bg-main);
}

.btn-primary:hover {
    /* background: var(--accent-secondary);  Removed color shift */
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(136, 192, 208, 0.25);
}

.btn-secondary {
    background: rgba(59, 66, 82, 0.5);
    /* Semi-opaque background */
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

:root.light-theme .btn-secondary {
    background: #ffffff;
    color: var(--text-primary);
    border-color: rgba(0, 0, 0, 0.25);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

:root.light-theme .btn-secondary:hover {
    background: #ffffff;
}


/* ===================================================
   LANDING PAGE — About Section
   =================================================== */

.landing-about {
    padding: 6rem 0;
}

.landing-about .section-title {
    margin-bottom: 3rem;
}

.section-title {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.section-subtitle {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
    opacity: 0.85;
    max-width: 600px;
    margin: 0 auto 3rem;
    line-height: 1.7;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5rem;
    margin-bottom: 3rem;
}

@media (min-width: 768px) {
    .about-grid {
        padding: 0 5rem;
    }
}

.about-card {
    /* Base styles */
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Glass effect override */
    background: rgba(59, 66, 82, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

:root.light-theme .about-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.03);
}

:root.light-theme .about-card:hover {
    background: #ffffff;
}

.about-card:hover {
    border-color: rgba(136, 192, 208, 0.2);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.about-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.about-card h3 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.about-card p {
    font-size: 1.35rem;
    color: var(--text-secondary);
    opacity: 0.9;
    line-height: 1.7;
}

.about-quote {
    text-align: left;
    margin: 12rem auto 6rem;
    max-width: 900px;
    padding: 0 1rem;
    /* Prevent touching edges on mobile */
}

.quote-text {
    font-size: 3.5rem;
    /* Force large size */
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.quote-author {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--accent-primary);
    opacity: 0.8;
    margin-left: 0.25rem;
    /* Slight offset to align visually with text */
}


/* ===================================================
   LANDING PAGE — Contribute Section
   =================================================== */

.landing-contribute {
    padding: 6rem 0;
    background: var(--bg-card);
}

.contribute-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.contribute-card {
    /* Base styles */
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;

    /* Glass effect override */
    background: rgba(59, 66, 82, 0.4) !important;
    /* Force override local bg */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

:root.light-theme .contribute-card {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.03);
}

:root.light-theme .contribute-card:hover {
    background: #ffffff !important;
}

.contribute-card:hover {
    border-color: rgba(136, 192, 208, 0.3);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.contribute-icon {
    color: var(--accent-primary);
    margin-bottom: 1.25rem;
}

.contribute-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.contribute-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    opacity: 0.85;
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

.contribute-link {
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.9rem;
    transition: opacity 0.2s ease;
}

.contribute-card:hover .contribute-link {
    opacity: 0.9;
}


/* ===================================================
   DECKS PAGE — Header / Hero Section
   =================================================== */

header {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-main) 100%);
    padding: 8rem 0 3rem;
    border-bottom: 1px solid var(--bg-card-hover);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(136, 192, 208, 0.1) 0%, rgba(46, 52, 64, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: var(--text-primary);
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* Stats Badges */
.stats-container {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.stat-badge {
    background: rgba(59, 66, 82, 0.5);
    border: 1px solid var(--bg-card-hover);
    padding: 0.5rem 1.25rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(4px);
}

:root.light-theme .stat-badge {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.stat-badge strong {
    color: var(--accent-primary);
    font-size: 1.1em;
}

/* Search Bar */
.search-container {
    max-width: 600px;
    margin: 0 auto 3rem;
    position: relative;
}

.search-control {
    position: relative;
    width: 100%;
}

:root.light-theme .search-control .search-input {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

:root.light-theme .search-control .search-input:focus {
    background: #ffffff;
    border-color: var(--accent-primary);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.1);
}

:root.light-theme .search-shortcut {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

.search-shortcut {
    position: absolute;
    right: 1.25rem;
    /* Adjusted right padding */
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    /* Matches search icon color */
    opacity: 1;
    /* Removed opacity */
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    /* Slight background for the circle */
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    padding-left: 3.5rem;
    /* Space for search icon */
    padding-right: 4rem;
    /* Space for shortcut icon */
    background: rgba(0, 0, 0, 0.25);
    /* Darker background for contrast */
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* Subtle border */
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: var(--shadow-md);
}

/* Main Content Grid */
.main-content {
    display: grid;
    gap: 2.5rem;
    padding-bottom: 4rem;
}

/* Subject Sections */
.subject-section {
    animation: fadeIn 0.5s ease-out;
}

.subject-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--bg-card);
}

:root.light-theme .subject-header {
    border-bottom-color: var(--accent-primary);
}

.subject-icon {
    width: 12px;
    height: 12px;
    background-color: var(--accent-primary);
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(136, 192, 208, 0.4);
}

.subject-title {
    font-size: 1.5rem;
    color: var(--text-primary);
}

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

/* Deck Card */
.deck-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.deck-card:hover {
    transform: translateY(-4px);
    border-color: rgba(136, 192, 208, 0.3);
    box-shadow: var(--shadow-lg);
}

.deck-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.deck-meta {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    background: var(--accent-primary);
    color: var(--bg-main);
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.download-btn:hover {
    /* background: var(--accent-secondary); Removed color shift */
    filter: brightness(1.1);
}

.download-btn svg {
    width: 1.2em;
    height: 1.2em;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    /* Improved contrast */
    font-size: 1.1rem;
    /* display: none; Handled by JS */
}

.no-results-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

/* Footer */
footer {
    margin-top: auto;
    background: var(--bg-card);
    padding: 2rem;
    text-align: center;
    border-top: 1px solid var(--bg-card-hover);
}

/* Landing page footer shouldn't have margin-top auto since sections fill space */
.landing-page footer {
    margin-top: 0;
}

footer p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    /* Removed opacity for better contrast */
}

footer a {
    color: var(--text-primary);
    text-decoration: underline;
    font-weight: 600;
}

footer a:hover {
    color: var(--accent-primary);
    text-decoration: none;
}

.footer-note {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Utilities */
.hidden {
    display: none !important;
}

/* ===================================================
   DECK ACTIONS & SMALL BUTTONS
   =================================================== */
.deck-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    flex-grow: 1;
    /* Make standard buttons fill available space */
}

/* Make preview button slightly less prominent than download */
.preview-btn {
    flex-grow: 0.5;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    background: rgba(59, 66, 82, 0.5);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

:root.light-theme .btn-icon {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.25);
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

:root.light-theme .btn-icon:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.btn-icon:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ===================================================
   TOAST NOTIFICATION
   =================================================== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--accent-primary);
    color: var(--bg-main);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===================================================
   PREVIEW MODAL
   =================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    /* display: flex maintained, visibility handled by opacity/pointer-events */
}

.modal-container {
    background: var(--bg-main);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 800px;
    height: 85vh;
    /* Large consistent height */
    max-height: 800px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--bg-card-hover);
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

:root.light-theme .modal-container {
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
}

.modal-overlay.hidden .modal-container {
    transform: translateY(20px);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    background: transparent;
    border: none;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--bg-card-hover);
    text-align: center;
}

:root.light-theme .modal-header {
    border-color: rgba(0, 0, 0, 0.1);
}

.modal-title {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    padding-right: 2rem;
    /* prevent overlap with close btn */
}

.modal-progress {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Flashcard Container and Flip logic */
.flashcard-container {
    flex-grow: 1;
    padding: 2rem;
    perspective: 1000px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg-card);
    /* slight contrast against modal bg */
}

.flashcard {
    width: 100%;
    max-width: 600px;
    height: 100%;
    min-height: 300px;
    max-height: 500px;
    position: relative;
    /* CSS transition for flipping removed to be instantaneous */
    transform-style: preserve-3d;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
}

.flashcard:active {
    cursor: grabbing;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg-main);
    border-radius: var(--radius-lg);
    border: 2px solid var(--bg-card-hover);
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    text-align: center;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.flashcard-face img {
    max-width: 100%;
    height: auto;
    max-height: 300px;
    border-radius: var(--radius-md);
    margin: 1rem 0;
}

:root.light-theme .flashcard-face {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.05);
}

.flashcard-back {
    transform: rotateY(180deg);
    border-color: var(--accent-primary);
}

/* Modal Controls */
.modal-controls {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--bg-card-hover);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

:root.light-theme .modal-controls {
    border-color: rgba(0, 0, 0, 0.1);
}

.btn-flip {
    min-width: 150px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


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

@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .search-container {
        padding: 0 1rem;
    }

    .deck-grid {
        grid-template-columns: 1fr;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .contribute-grid {
        grid-template-columns: 1fr;
    }

    .landing-hero {
        padding: 8rem 0 4rem;
    }

    .landing-hero .hero-title {
        font-size: 2.25rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 320px;
        justify-content: center;
    }

    .about-quote blockquote {
        font-size: 1.1rem;
    }
}