/* Kitchen FAQ — Base Styles */
/* Ukrainian flag accent colors */

:root {
    --primary-blue: #0057b7;
    --accent-yellow: #ffd700;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --primary-text: #24292e;
    --secondary-text: #586069;
    --muted-text: #6a737d;
    --border-color: #e1e4e8;
    --background-light: #fafbfc;
    --white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
}

/* ============================================================
   Base Layout
   ============================================================ */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-light);
    color: var(--primary-text);
    line-height: 1.5;
}

/* ============================================================
   Header — Ukrainian flag gradient
   ============================================================ */
.header {
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    background: linear-gradient(
        180deg,
        var(--primary-blue) 0%,
        var(--primary-blue) 50%,
        var(--accent-yellow) 50%,
        var(--accent-yellow) 100%
    );
}

.header-title {
    color: var(--accent-yellow);
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.header-subtitle {
    background-color: rgba(255, 215, 0, 0.9);
    color: #212529;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 4px;
    display: inline-block;
    font-size: 0.9rem;
}

/* ============================================================
   Navigation
   ============================================================ */
.nav {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.nav .nav-link {
    padding: 8px 16px;
    text-decoration: none;
    background-color: var(--primary-blue);
    color: var(--accent-yellow) !important;
    border: 2px solid var(--accent-yellow);
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav .nav-link:hover,
.nav .nav-link:active {
    background-color: var(--accent-yellow);
    color: #212529 !important;
    border-color: var(--primary-blue);
}

.nav .nav-link.active {
    background-color: var(--accent-yellow);
    color: #212529 !important;
    font-weight: bold;
}

/* Theme toggle button */
.theme-toggle {
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    background: var(--primary-blue);
    border: 2px solid var(--accent-yellow);
}

.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline; }
[data-theme="dark"] .theme-icon-light { display: none; }

/* ============================================================
   Main Content
   ============================================================ */
.main-content {
    min-height: calc(100vh - 200px);
    padding-top: 24px;
    padding-bottom: 40px;
}

/* ============================================================
   FAQ Search Bar
   ============================================================ */
.faq-search-form {
    max-width: 700px;
}

.faq-search-input {
    font-size: 1rem;
}

/* ============================================================
   Access Banner
   ============================================================ */
.faq-access-banner {
    border-left: 4px solid var(--info);
    background: rgba(23, 162, 184, 0.08);
}

/* ============================================================
   Tag Section Accordion
   ============================================================ */
.tag-section {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--white);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.tag-section-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.05rem;
    border-left: 4px solid var(--primary-blue);
    background: rgba(0, 87, 183, 0.04);
    user-select: none;
    list-style: none;
}

.tag-section-summary::-webkit-details-marker {
    display: none;
}

.tag-section-summary::before {
    content: '+';
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-blue);
    min-width: 18px;
    text-align: center;
    transition: transform 0.2s ease;
}

details.tag-section[open] > .tag-section-summary::before {
    content: '-';
}

.tag-section-name {
    flex: 1;
    color: var(--primary-text);
}

.tag-section-count {
    font-size: 0.8rem;
}

.tag-section-body {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

/* ============================================================
   FAQ Entry Cards
   ============================================================ */
.faq-entry {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white);
    transition: box-shadow 0.2s ease;
}

.faq-entry:hover {
    box-shadow: var(--shadow-md);
}

.faq-entry-summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.faq-entry-summary::-webkit-details-marker {
    display: none;
}

.faq-entry-title {
    font-weight: 600;
    color: var(--primary-text);
    font-size: 0.97rem;
}

.faq-entry-snippet {
    font-size: 0.85rem;
    color: var(--muted-text);
}

.faq-entry-content {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border-color);
    font-size: 0.95rem;
    line-height: 1.6;
}

.faq-entry-content p:last-child {
    margin-bottom: 0;
}

/* ============================================================
   Expand/Collapse controls
   ============================================================ */
.faq-expand-controls {
    flex-wrap: wrap;
}

/* ============================================================
   Empty state
   ============================================================ */
.faq-empty {
    text-align: center;
    color: var(--muted-text);
    padding: 48px 24px;
    font-size: 1.05rem;
}

/* ============================================================
   Visibility Badges
   ============================================================ */
.badge-visibility-public {
    background-color: #28a745;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-visibility-prospect {
    background-color: #0057b7;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-visibility-accepted {
    background-color: #b8860b;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ============================================================
   Tag Badges (admin list)
   ============================================================ */
.badge-tag {
    background-color: rgba(0, 87, 183, 0.12);
    color: var(--primary-blue);
    border: 1px solid rgba(0, 87, 183, 0.25);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 500;
}

/* ============================================================
   Admin Table
   ============================================================ */
.admin-table th {
    border-bottom: 2px solid var(--primary-blue);
    color: var(--primary-blue);
    font-weight: 600;
    white-space: nowrap;
}

.admin-table td {
    vertical-align: middle;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: var(--white);
}

.card-header {
    background: var(--white);
    border-bottom: 2px solid var(--primary-blue);
    font-weight: 600;
    color: var(--primary-blue);
    padding: 14px 20px;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
    background: var(--white);
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    margin-top: 40px;
}

.footer a {
    color: var(--primary-blue);
    text-decoration: none;
}

.footer a:hover {
    color: #004494;
    text-decoration: underline;
}

/* ============================================================
   Alert overrides (custom left-border style)
   ============================================================ */
.alert {
    border: none;
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    border-left-color: var(--success);
    color: #155724;
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    border-left-color: var(--danger);
    color: #721c24;
}

.alert-info {
    background: rgba(23, 162, 184, 0.1);
    border-left-color: var(--info);
    color: #0c5460;
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    border-left-color: var(--warning);
    color: #856404;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .main-content {
        padding-left: 14px;
        padding-right: 14px;
    }

    .tag-section-summary {
        font-size: 0.98rem;
        padding: 12px 14px;
    }

    .admin-table {
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .header-title {
        font-size: 1.4rem;
    }

    .faq-search-form {
        width: 100%;
    }

    .faq-expand-controls .btn {
        font-size: 0.85rem;
    }
}

/* Updated or New pseudo-tag */
.tag-section-summary-updated {
    border-left-color: #ffc933 !important;
    background: rgba(255, 201, 51, 0.06) !important;
}

[data-theme="dark"] .tag-section-summary-updated {
    border-left-color: #ffc933 !important;
    background: rgba(255, 201, 51, 0.08) !important;
}

/* Ukrainian flag SVG in page chrome (issue #68) — replaces the 🇺🇦 emoji,
   which Windows renders as the letters "UA" (no glyphs for regional-indicator
   pairs in Segoe UI Emoji). Sized in em so it follows the surrounding text. */
.ua-flag {
    display: inline-block;
    width: 1.15em;
    height: calc(1.15em * 2 / 3);
    vertical-align: -0.08em;
    margin-right: 0.15em;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .ua-flag {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
}

/* ===========================================================================
   Responsive data tables (#86) — mirrors kitchen_scheduler/static/css/components.css.
   Below 768px each row becomes a card and each cell prints its own column name.
   Opt in with class="responsive-table" AND a data-label on every <td>.
   These apps do not share the scheduler stylesheet, so the rules are repeated
   here rather than imported.
   =========================================================================== */
@media (max-width: 768px) {
    .responsive-table {
        border: none;
        background: transparent;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table tbody,
    .responsive-table tbody tr,
    .responsive-table tbody td {
        display: block;
    }

    .responsive-table tbody tr {
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        margin-bottom: 15px;
        padding: 15px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .responsive-table tbody td {
        border: none;
        padding: 8px 0;
        text-align: left;
        overflow-wrap: anywhere;
        /* Desktop column widths must not survive into a card. */
        width: auto !important;
    }

    /* Inside a card there is no desktop row to protect, so nothing may refuse
       to wrap — one long value would push the card past the screen edge. */
    .responsive-table tbody td,
    .responsive-table tbody td *:not(code):not(pre) {
        white-space: normal;
    }

    /* A cell with NO data-label prints no heading at all. That is the opt-out for
       a cell that is the card's title or its footer of buttons — omit the
       attribute rather than reach for a page-specific :last-child override. */
    .responsive-table tbody td:not([data-label])::before {
        content: none;
    }

    .responsive-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #005BBB;
        display: block;
        margin-bottom: 5px;
        font-size: 14px;
    }

    .responsive-table tbody td:last-child {
        text-align: center;
        padding-top: 15px;
        border-top: 1px solid #eee;
        margin-top: 8px;
    }
}
