/* GermanDict custom styles */

/* Gender colors */
.gender-m { color: #2563eb; }  /* der - blue */
.gender-f { color: #dc2626; }  /* die - red */
.gender-n { color: #16a34a; }  /* das - green */

/* Brand */
.brand { text-decoration: none; }
.brand strong {
    font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
    font-size: clamp(1.3rem, 2.1vw, 1.8rem);
    letter-spacing: 0.02em;
    font-weight: 700;
    line-height: 1;
    color: var(--pico-color);
}
.brand:hover strong {
    color: var(--pico-primary);
}

/* ============================
   Search dropdown
   ============================ */
.search-wrapper { position: relative; }
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--pico-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0 0 var(--pico-border-radius) var(--pico-border-radius);
    max-height: 400px;
    overflow-y: auto;
}
.search-dropdown:empty { display: none; }
.search-results-list { list-style: none; margin: 0; padding: 0; }
.search-results-list li { border-bottom: 1px solid var(--pico-muted-border-color); }
.search-results-list li:last-child { border-bottom: none; }
.search-results-list li a {
    display: block;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: var(--pico-color);
}
.search-results-list li a:hover { background: var(--pico-primary-focus); }
.search-gloss { color: var(--pico-muted-color); font-size: 0.85em; }
.search-all a { text-align: center; font-weight: bold; }

/* ============================
   Tags & Badges
   ============================ */
.tag {
    background: var(--pico-muted-border-color);
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}
.list-tags {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.25rem;
}
.list-tags .tag {
    margin-left: 0;
}
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: white;
}
.badge-a1 { background: #16a34a; }
.badge-a2 { background: #059669; }
.badge-b1 { background: #2563eb; }
.badge-b2 { background: #ea580c; }
.badge-c1 { background: #dc2626; }
.badge-c2 { background: #7c3aed; }

/* ============================
   Toast notifications
   ============================ */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 12000;
}
.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--pico-border-radius);
    margin-bottom: 0.5rem;
    animation: toast-in 0.3s ease-out;
    font-size: 0.9rem;
}
.toast-success { background: #16a34a; color: white; }
.toast-info { background: #2563eb; color: white; }
.toast-error { background: #dc2626; color: white; }

/* Match account-style flash UI inside List Settings modal notifications */
#settings-toast .toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--pico-border-radius);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    animation: none;
}
#settings-toast .toast-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
#settings-toast .toast-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}
#settings-toast .toast-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(1rem); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============================
   Flash messages
   ============================ */
.flash {
    padding: 0.75rem 1.25rem;
    border-radius: var(--pico-border-radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ============================
   Quiz styles
   ============================ */
.correct-answer { color: #16a34a; font-size: 1.5rem; font-weight: bold; }
.wrong-answer { color: #dc2626; font-size: 1.5rem; font-weight: bold; }

/* Prevent any style leaking quiz answers */
#quiz-area button.outline,
#quiz-area button.outline:visited,
#quiz-area button.outline:active,
#quiz-area button.outline:focus {
    color: var(--pico-primary) !important;
    background-color: transparent !important;
    border-color: var(--pico-primary) !important;
    opacity: 1 !important;
}
#quiz-area button.outline:hover {
    color: var(--pico-primary-inverse) !important;
    background-color: var(--pico-primary) !important;
}
.flashcard { min-height: 300px; }
.flashcard-answer { text-align: left; max-width: 500px; margin: 0 auto; }
.rating-row {
    display: flex;
    gap: 0.5rem;
}
.rating-row form {
    flex: 1;
    margin: 0;
}
.rating-row button {
    width: 100%;
    margin: 0;
}

.umlaut-helper { display: flex; gap: 0.25rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.umlaut-helper button {
    padding: 0.25rem 0.75rem;
    font-size: 1.1rem;
    width: auto;
    margin: 0;
}

.active-sort { font-weight: bold; text-decoration: underline; }
.overflow-auto { overflow-x: auto; }

.declension-table td { min-width: 100px; }

/* Breadcrumb nav */
nav[aria-label="breadcrumb"] ul {
    list-style: none;
    display: flex;
    gap: 0.5rem;
    padding: 0;
    margin: 0 0 1rem 0;
}
nav[aria-label="breadcrumb"] li:not(:last-child)::after {
    content: "\203A";
    margin-left: 0.5rem;
    color: var(--pico-muted-color);
}

/* Dropdown fixes */
details.dropdown ul { list-style: none; padding: 0; min-width: 200px; }
details.dropdown ul li { padding: 0; }
details.dropdown ul li form button {
    margin: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

/* Word detail list picker: open left, anchored to button's right edge. */
.wordbank-dropdown {
    position: relative;
}
.wordbank-dropdown > ul {
    position: absolute;
    right: 0 !important;
    left: auto !important;
    inset-inline-end: 0 !important;
    inset-inline-start: auto !important;
    width: max-content;
    min-width: max-content;
    max-width: min(90vw, 32rem);
}
.wordbank-dropdown > ul button {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* User menu dropdown: keep compact and aligned */
.user-dropdown { position: relative; }
.user-dropdown .user-menu {
    min-width: 180px;
    width: max-content;
    left: auto;
    right: 0;
    padding: 0;
}
.user-dropdown .user-menu li { margin: 0; }
.user-dropdown .user-menu li > a,
.user-dropdown .user-menu-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    text-align: center;
    color: var(--pico-primary);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    min-height: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.user-dropdown .user-menu li > a {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    text-align: center !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
}
.user-dropdown .user-menu-btn {
    -webkit-appearance: none;
    appearance: none;
}
.user-dropdown .user-menu a:hover,
.user-dropdown .user-menu-btn:hover {
    background: var(--pico-primary-focus);
}

/* Word header flex layout */
.word-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.quiz-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.quiz-buttons a { text-align: center; }
.quiz-buttons-vertical { flex-direction: column; }

/* ============================
   Homepage
   ============================ */
.hero {
    text-align: center;
    padding: 2rem 0 1rem;
}
.hero h1 {
    margin-bottom: 0.25rem;
    font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.hero p { color: var(--pico-muted-color); margin-bottom: 1.5rem; }
.hero-search { max-width: 500px; margin: 0 auto 0.5rem; }
.hero-stat { color: var(--pico-muted-color); }

/* Stats row */
.stats-row {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 1rem 0 2rem;
    padding: 1rem;
    background: var(--pico-card-background-color);
    border-radius: var(--pico-border-radius);
}
.stat-item {
    text-align: center;
}
.stat-item strong {
    display: block;
    font-size: 1.4rem;
    color: var(--pico-primary);
}
.stat-item small {
    color: var(--pico-muted-color);
}

/* Word of the Day / Random Word */
.home-feature-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
.wod-section { margin-bottom: 2rem; }
.wod-section h3 { margin-bottom: 0.75rem; text-align: center; }
.wod-card { padding: 1.5rem; text-align: center; }
.wod-word {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.wod-word a { text-decoration: none; }
.wod-reveal-btn { font-size: 0.9rem; }
.wod-translation { animation: fade-in 0.3s ease; }
.wod-example { margin: 0.75rem auto; padding: 0.75rem 1rem; max-width: 500px; }

@keyframes fade-in {
    from { opacity: 0; transform: translateY(-0.25rem); }
    to { opacity: 1; transform: translateY(0); }
}

/* Quick links */
.quick-links { margin-bottom: 2rem; }
.quick-links h3 { margin-bottom: 1rem; }
.quick-links article { padding: 1.25rem; }
.quick-links article h4 { margin-bottom: 0.5rem; }
.quick-links article p { font-size: 0.9rem; color: var(--pico-muted-color); margin-bottom: 0.75rem; }
.quick-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.quick-form input { margin-bottom: 0; }
.quick-form button { width: auto; white-space: nowrap; }

.word-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.word-chips small { color: var(--pico-muted-color); margin-right: 0.25rem; }
.word-chips a {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    background: var(--pico-primary-focus);
    border-radius: 1rem;
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--pico-primary);
    transition: background 0.15s;
}
.word-chips a:hover {
    background: var(--pico-primary);
    color: white;
}

/* Featured lists */
.featured-lists { margin-bottom: 2rem; }
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.section-header h3 { margin-bottom: 0; }
.section-header a { font-size: 0.9rem; }

.featured-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.featured-card {
    flex: 0 0 200px;
    scroll-snap-align: start;
    padding: 1rem;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    text-decoration: none;
    color: var(--pico-color);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: border-color 0.15s;
}
.featured-card:hover {
    border-color: var(--pico-primary);
}
.featured-card strong { font-size: 0.9rem; }
.featured-card small { color: var(--pico-muted-color); font-size: 0.8rem; }

/* CTA section */
.cta-section {
    text-align: center;
    padding: 1.5rem;
    margin-bottom: 2rem;
    background: var(--pico-card-background-color);
    border-radius: var(--pico-border-radius);
}

/* ============================
   Explore Page
   ============================ */
.explore-search { max-width: 500px; }
.explore-search input { margin-bottom: 0; }

.explore-category { margin-bottom: 2rem; }
.category-header {
    font-size: 1.1rem;
    border-bottom: 2px solid var(--pico-primary);
    padding-bottom: 0.35rem;
    margin-bottom: 0.75rem;
}

.explore-scroll {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    align-items: start;
}

.explore-category.collapsed .explore-scroll { display: none; }
.explore-category.collapsed .collapse-icon { display: inline-block; transform: rotate(-90deg); }
.collapse-icon { display: inline-block; transition: transform 0.2s; font-size: 0.8em; }

.list-card {
    padding: 1rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    background: var(--pico-card-background-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 300px;
    height: 300px;
    overflow: hidden;
}
.list-card.expanded {
    height: auto;
    overflow: visible;
}
.list-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}
.list-card-header a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.list-card-desc {
    font-size: 0.85rem;
    color: var(--pico-muted-color);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.list-card-meta {
    display: flex;
    justify-content: space-between;
    color: var(--pico-muted-color);
    gap: 0.5rem;
}
.list-card-meta small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list-card footer { margin-top: auto; padding: 0 0.25rem; }
.list-card footer form { margin: 0; }
.copy-btn {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.add-bank-btn {
    font-size: 0.8rem;
    letter-spacing: 0.01em;
}

/* ============================
   List Settings
   ============================ */
.list-settings {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    align-items: start;
}
.settings-form label {
    margin-bottom: 0.5rem;
}
.settings-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.settings-actions form { margin: 0; }
.settings-actions button { margin: 0; }

/* ============================
   List Preview (Explore)
   ============================ */
.preview-area { margin-top: 0.5rem; }
.list-preview {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    animation: fade-in 0.2s ease;
}
.list-preview table {
    margin: 0;
    font-size: 0.85rem;
    white-space: normal;
}
.list-preview table td,
.list-preview table th {
    padding: 0.35rem 0.5rem;
}

/* ============================
   Mobile Nav - Hamburger Menu
   ============================ */
.mobile-nav {
    display: none;
}
.mobile-nav-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.mobile-nav-right .mobile-top-link + .mobile-top-link {
    margin-left: 0.35rem;
}
.mobile-nav-right .mobile-top-link + .mobile-nav-btn {
    margin-left: 0.35rem;
}
.mobile-nav-right .mobile-top-link + .mobile-user-dropdown {
    margin-left: 0.45rem;
}
.mobile-top-link {
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--pico-primary);
    white-space: nowrap;
}
.mobile-nav-btn {
    margin: 0;
    padding: 0.28rem 0.55rem;
    font-size: 0.75rem;
    line-height: 1.1;
    border-radius: var(--pico-border-radius);
    min-width: auto;
    white-space: nowrap;
}
.mobile-user-dropdown summary {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.12rem 0.6rem !important;
    margin: 0;
    white-space: nowrap;
    min-width: 6.2rem;
    line-height: 1.1;
    min-height: 0;
}
.mobile-user-dropdown .user-menu {
    right: 0;
    left: auto;
}
.mobile-overlay {
    display: none;
}
.mobile-drawer {
    display: none;
}

.hamburger {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0;
    width: auto;
}
.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--pico-color);
    transition: transform 0.2s;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
}
.drawer-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: auto;
    margin: 0;
    color: var(--pico-color);
}
.drawer-search {
    padding: 0.75rem 1.25rem;
}
.drawer-search input { margin-bottom: 0; }
.drawer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}
.drawer-links li { border-bottom: 1px solid var(--pico-muted-border-color); }
.drawer-links li a {
    display: block;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    color: var(--pico-color);
    font-size: 1rem;
}
.drawer-links li a:hover { background: var(--pico-primary-focus); }
.drawer-auth {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.9rem 1.25rem 1.25rem;
}
.drawer-auth a[role="button"] {
    width: 100%;
    margin: 0;
    text-align: center;
}

/* ============================
   Mobile Responsive Styles
   ============================ */
@media (max-width: 768px) {
    /* Show mobile nav, hide desktop nav */
    .desktop-nav { display: none !important; }
    .mobile-nav {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid var(--pico-muted-border-color);
    }
    .mobile-nav .brand {
        max-width: 34vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-nav .brand strong {
        font-size: 1rem;
    }
    .mobile-nav-right {
        flex: 0 0 auto;
        gap: 0.25rem;
    }
    .mobile-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }
    .mobile-overlay.open {
        opacity: 1;
        visibility: visible;
    }
    .mobile-drawer {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        background: var(--pico-background-color);
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }
    .mobile-drawer.open {
        transform: translateX(0);
    }
    #toast-container {
        top: 4.25rem;
        right: 0.75rem;
        left: 0.75rem;
        z-index: 900;
    }

    /* Tables: horizontal scroll */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Word detail: stack header */
    .word-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Quiz buttons stack on mobile */
    .quiz-buttons {
        flex-direction: column;
    }

    /* Smaller text sizes */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    /* Stat cards */
    .stats-row { gap: 1rem; padding: 0.75rem; }
    .stat-item strong { font-size: 1.2rem; }

    /* Flashcard smaller on mobile */
    .flashcard { min-height: 200px; }

    /* Featured cards smaller */
    .featured-card { flex: 0 0 170px; padding: 0.75rem; }

    /* Quick links full width */
    .quick-links .grid { grid-template-columns: 1fr; }

    /* Explore grid single column */
    .explore-scroll { grid-template-columns: 1fr; }
    .list-card {
        height: auto;
        min-height: 0;
    }
    .list-card footer {
        margin-top: 0.5rem;
    }

    /* List settings stack */
    .list-settings { grid-template-columns: 1fr; }
}

@media (min-width: 769px) {
    .home-feature-row {
        grid-template-columns: 1fr 1fr;
        align-items: stretch;
        gap: 1.25rem;
        margin-bottom: 2rem;
    }
    .home-feature-row .wod-section {
        margin-bottom: 0;
        display: flex;
        flex-direction: column;
    }
    .home-feature-row .wod-card {
        flex: 1;
        min-height: 260px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    main.container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    h1 { font-size: 1.3rem; }
    h2 { font-size: 1.15rem; }
    h3 { font-size: 1.05rem; }

    .featured-card { flex: 0 0 150px; }
}
