/* Page styles for index.php (loaded after Bootstrap). */

:root {
    --ink: #1c2434;
    --muted: #5f6b7a;
    --navy: #1f3a6e;
    --navy-dark: #172c54;
    --link: #1a56c4;
    --brand-red: #d7261e;
    --line: #e2e5ea;
    --tint: #eef2f8;
    --page: #f3f4f6;
    --surface: #ffffff;
}

body {
    font-family: 'Microsoft JhengHei', 'PingFang TC', 'Noto Sans TC', Arial, sans-serif;
    background-color: var(--page);
    color: var(--ink);
    line-height: 1.6;
}

.container {
    max-width: 1080px;
}

a {
    color: var(--link);
}

/* Bootstrap primary buttons follow the page palette. */
.btn-primary {
    --bs-btn-bg: var(--navy);
    --bs-btn-border-color: var(--navy);
    --bs-btn-hover-bg: var(--navy-dark);
    --bs-btn-hover-border-color: var(--navy-dark);
    --bs-btn-active-bg: var(--navy-dark);
    --bs-btn-active-border-color: var(--navy-dark);
    --bs-btn-disabled-bg: var(--navy);
    --bs-btn-disabled-border-color: var(--navy);
}

/* ---------- Header ---------- */

.site-header {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 28px;
    align-items: center;
    padding: 22px 24px;
    margin-bottom: 20px;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-top: 4px solid var(--brand-red);
    border-radius: 8px;
}

.site-header__logo img {
    display: block;
    width: 100%;
    height: auto;
}

.site-header__title {
    margin: 0 0 12px;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.site-header__note {
    display: block;
    padding: 6px 10px 6px 14px;
    border-left: 3px solid var(--brand-red);
    border-radius: 0 6px 6px 0;
    color: var(--ink);
    font-size: 0.95rem;
    line-height: 1.75;
    text-decoration: none;
}

.site-header__note + .site-header__note {
    margin-top: 10px;
}

.site-header__note i {
    margin-left: 6px;
    color: var(--link);
    font-size: 0.8em;
}

.site-header__note:hover,
.site-header__note:focus-visible {
    background-color: var(--tint);
    color: var(--ink);
}

/* ---------- Search ---------- */

.search-form {
    padding: 22px 24px;
    margin-bottom: 14px;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.search-form__label {
    margin-bottom: 6px;
    font-weight: 700;
}

.search-form__hint {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.875rem;
}

.search-form .form-control:focus {
    border-color: var(--navy);
    box-shadow: 0 0 0 0.2rem rgba(31, 58, 110, 0.18);
}

.captcha-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding: 14px 16px;
    background-color: var(--tint);
    border-left: 3px solid var(--navy);
    border-radius: 0 6px 6px 0;
}

.captcha-card__text {
    display: flex;
    align-items: center;
    gap: 12px;
}

.captcha-card__text i {
    color: var(--navy);
    font-size: 1.6rem;
}

.captcha-card__text strong {
    display: block;
}

.captcha-card__text span {
    color: var(--muted);
    font-size: 0.875rem;
}

/* reCAPTCHA is a fixed 304px iframe; let it shrink on narrow phones instead of overflowing. */
.captcha-card .g-recaptcha {
    max-width: 100%;
    overflow: hidden;
}

.verified-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #e9f6ec;
    border-radius: 6px;
    color: #256b36;
    font-size: 0.875rem;
}

.resource-links {
    margin: 0 0 18px;
}

/* Full-page notice while the server gathers results (replaces the old alert box). */
.search-progress {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: rgba(28, 36, 52, 0.55);
}

.search-progress[hidden] {
    display: none;
}

.search-progress__box {
    display: flex;
    align-items: center;
    gap: 18px;
    max-width: 440px;
    padding: 22px 26px;
    background-color: var(--surface);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.search-progress__box .spinner-border {
    flex: none;
    color: var(--navy);
}

.search-progress__box p {
    margin: 0;
    color: var(--muted);
}

.search-progress__box strong {
    display: block;
    color: var(--ink);
    font-size: 1.05rem;
}

/* ---------- Result sections ---------- */

.data-section {
    margin-bottom: 18px;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(28, 36, 52, 0.04);
    overflow: hidden;
}

.section-title {
    display: flex;
    align-items: baseline;
    padding: 14px 18px;
    margin: 0;
    background-color: var(--surface);
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.5;
}

.section-title i {
    flex: none;
    width: 1.4em;
    color: var(--navy);
}

.section-content {
    max-height: 520px;
    overflow-y: auto;
    padding: 16px 18px;
}

.section-content > :last-child {
    margin-bottom: 0;
}

/* Section 4 keeps its link row between the title and the scrolling area. */
.data-section > .mb-2 {
    margin: 14px 18px 0 !important;
}

.empty-hint {
    margin: 0;
    color: var(--muted);
}

.empty-hint i {
    margin-right: 8px;
    color: #9aa5b4;
}

/* External-reference buttons: quiet, so results stay the focus. */
.data-section .btn-outline-info,
.resource-links .btn-outline-secondary {
    --bs-btn-color: var(--navy);
    --bs-btn-border-color: #cfd6e2;
    --bs-btn-hover-color: var(--navy);
    --bs-btn-hover-bg: var(--tint);
    --bs-btn-hover-border-color: var(--navy);
    --bs-btn-active-color: var(--navy);
    --bs-btn-active-bg: var(--tint);
    --bs-btn-active-border-color: var(--navy);
    margin: 0 6px 6px 0 !important;
    background-color: var(--surface);
}

.data-section .btn-outline-info:hover,
.resource-links .btn-outline-secondary:hover {
    background-color: var(--tint);
}

.section-content .alert {
    border-radius: 6px;
}

/* Section 1: company registration */
#a .table {
    margin-bottom: 0;
    --bs-table-striped-bg: transparent;
    border-color: var(--line);
}

#a .table th {
    background-color: var(--tint) !important;
    color: var(--ink);
    font-size: 1.05rem;
}

#a .table ul {
    margin: 0;
}

#a .table li {
    padding: 3px 0;
}

#a .table li strong {
    display: inline-block;
    min-width: 12.5em;
    color: var(--muted);
    font-weight: 500;
}

/* Link out to the official registry page for the company shown above. */
#a .btn-info {
    background-color: var(--surface);
    border-color: #cfd6e2;
    color: var(--navy);
}

#a .btn-info:hover,
#a .btn-info:focus-visible {
    background-color: var(--tint);
    border-color: var(--navy);
    color: var(--navy);
}

/* Section 4: certification card */
#d .card {
    border-color: var(--line);
}

/* Section 5: search-engine shortcuts share one neutral look; the icon carries the brand colour. */
#f .d-flex .btn {
    background-color: var(--surface);
    border-color: #cfd6e2;
    color: var(--ink);
}

#f .d-flex .btn:hover,
#f .d-flex .btn:focus-visible {
    background-color: var(--tint);
    border-color: var(--navy);
    color: var(--ink);
}

#f .fa-google { color: #4285f4; }
#f .fa-yahoo { color: #6001d2; }
#f .fa-youtube { color: #e62117; }
#f .fa-home { color: var(--navy); }

/* Sections 2 and 3: FTC decisions and court judgments */
.case-records__summary {
    margin: 0 0 10px;
    color: var(--muted);
}

.case-records__summary strong {
    color: var(--ink);
}

.case-records {
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.95rem;
}

.case-records__head,
.case-record {
    display: grid;
    grid-template-columns: 6.5rem 11rem minmax(0, 1fr);
    column-gap: 20px;
    padding: 10px 14px;
}

.case-records--court .case-records__head,
.case-records--court .case-record {
    grid-template-columns: 6.5rem 14rem minmax(0, 1fr);
}

.case-records__head {
    position: sticky;
    top: -16px;
    z-index: 1;
    background-color: var(--tint);
    border-bottom: 1px solid var(--line);
    border-radius: 6px 6px 0 0;
    color: var(--navy);
    font-size: 0.875rem;
    font-weight: 700;
}

.case-record {
    align-items: start;
    line-height: 1.6;
}

.case-record + .case-record {
    border-top: 1px solid var(--line);
}

.case-record:hover {
    background-color: #f7f9fc;
}

.case-record__date {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.case-record__ref small {
    display: block;
    color: var(--muted);
}

.case-record__main a {
    text-decoration: none;
}

.case-record__main a:hover,
.case-record__main a:focus {
    text-decoration: underline;
}

.case-record__main i {
    width: 1.1em;
    margin-right: 6px;
    color: #8a94a3;
}

.case-record__main .fa-file-pdf {
    color: #c0392b;
}

/* Fallback when the FTC markup cannot be parsed and is shown as scraped. */
.quizzes_list .thead,
.quizzes_list .result-list {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    padding: 12px 0;
    margin: 0;
    list-style: none;
}

.quizzes_list .thead {
    background-color: var(--tint);
    color: var(--navy);
    font-weight: 700;
}

.quizzes_list .thead li,
.quizzes_list .result-list li {
    flex: 1 1 120px;
    padding: 0 8px;
}

.footer {
    padding: 20px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 768px) {
    .site-header {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        padding: 18px 16px;
    }

    .site-header__logo img {
        max-width: 220px;
        margin: 0 auto;
    }

    .site-header__title {
        font-size: 1.3rem;
        text-align: center;
    }

    .search-form {
        padding: 18px 16px;
    }

    .section-title {
        padding: 12px 14px;
        font-size: 1rem;
    }

    .section-content {
        max-height: 420px;
        padding: 14px;
    }

    .data-section > .mb-2 {
        margin: 12px 14px 0 !important;
    }

    #a .table li strong {
        display: block;
        min-width: 0;
    }

    .case-records__head {
        display: none;
    }

    .case-record,
    .case-records--court .case-record {
        grid-template-columns: auto minmax(0, 1fr);
        column-gap: 12px;
        row-gap: 2px;
    }

    .case-record__date,
    .case-record__ref {
        color: var(--muted);
        font-size: 0.85rem;
    }

    .case-record__ref small {
        display: inline;
        margin-left: 8px;
    }

    /* The linked text is the row's main content: full width, first line. */
    .case-record__main {
        grid-column: 1 / -1;
        grid-row: 1;
        font-size: 1rem;
    }
}
