/* ================================================================
   COUNTRY PROFILE FLY-OUT PANEL
   Adapted from Wortham Labs SeraSeal panel pattern.
   Uses Dormir Aqui design tokens (inherits from parent layout).
   ================================================================ */

/* ── Backdrop ── */
.country-panel__backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(0,0,0,0.45);
    transition: opacity 0.25s ease;
    opacity: 0;
}
.country-panel__backdrop.active {
    display: block;
    opacity: 1;
}

/* ── Panel shell ── */
.country-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    z-index: 901;
    background: var(--surface, #141a23);
    border-left: 1px solid var(--line, rgba(255,255,255,0.06));
    box-shadow: -8px 0 48px rgba(0,0,0,0.5);
    transform: translateX(460px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.country-panel.active {
    transform: translateX(0);
}

/* ── Close button ── */
.country-panel__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 5;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line, rgba(255,255,255,0.06));
    background: var(--surface-glass, rgba(255,255,255,0.04));
    color: var(--muted, #8a857e);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    min-height: auto;
    transition: border-color 0.15s, color 0.15s;
}
.country-panel__close:hover {
    border-color: var(--warm, #d4a574);
    color: var(--ink, #e8e4df);
}

/* ── Hero section (dark header) ── */
.country-panel__hero {
    padding: 2rem 1.75rem 1.5rem;
    background:
        radial-gradient(ellipse at top right, var(--warm-glow, rgba(212,165,116,0.06)), transparent 60%),
        var(--surface-raised, #1c2028);
    border-bottom: 1px solid var(--line, rgba(255,255,255,0.06));
    flex-shrink: 0;
}
.country-panel__identity {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.country-panel__flag {
    font-size: 48px;
    line-height: 1;
    flex-shrink: 0;
}
.country-panel__flag img {
    width: 56px;
    height: auto;
    border-radius: 4px;
}
.country-panel__name {
    font-family: var(--font-display, 'Fraunces', Georgia, serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink-strong, #fff);
    line-height: 1.15;
}
.country-panel__region {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--warm, #d4a574);
    margin-top: 0.2rem;
}

/* ── Distance callout ── */
.country-panel__distance {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: var(--surface-glass, rgba(255,255,255,0.04));
    border: 1px solid var(--line, rgba(255,255,255,0.06));
    margin-bottom: 1rem;
}
.country-panel__distance-line {
    font-size: 0.88rem;
    color: var(--ink, #e8e4df);
    line-height: 1.5;
    font-weight: 500;
}
.country-panel__distance-note {
    font-size: 0.78rem;
    color: var(--muted, #8a857e);
    margin-top: 0.35rem;
    line-height: 1.5;
    font-style: italic;
}

/* ── Greeting callout (prominent) ── */
.country-panel__greeting {
    padding: 1.1rem 1.25rem;
    border-radius: 14px;
    background: var(--warm-dim, rgba(212,165,116,0.12));
    border: 1px solid var(--line-warm, rgba(212,165,116,0.18));
}
.country-panel__greeting-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--warm, #d4a574);
    margin-bottom: 0.5rem;
}
.country-panel__greeting-word {
    font-family: var(--font-display, 'Fraunces', Georgia, serif);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ink-strong, #fff);
    line-height: 1.2;
}
.country-panel__greeting-phonetic {
    font-size: 1rem;
    color: var(--warm, #d4a574);
    font-weight: 600;
    margin-top: 0.15rem;
}
.country-panel__greeting-divider {
    height: 1px;
    background: var(--line, rgba(255,255,255,0.06));
    margin: 0.75rem 0;
}

/* ── Scrollable content ── */
.country-panel__body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1.75rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--line, rgba(255,255,255,0.06)) transparent;
}
.country-panel__body::-webkit-scrollbar { width: 4px; }
.country-panel__body::-webkit-scrollbar-track { background: transparent; }
.country-panel__body::-webkit-scrollbar-thumb { background: var(--line, rgba(255,255,255,0.06)); border-radius: 2px; }

/* ── Content sections ── */
.country-panel__section {
    display: grid;
    gap: 0.4rem;
}
.country-panel__section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--teal, #5ab5b2);
}
.country-panel__section-text {
    font-size: 0.9rem;
    color: var(--ink, #e8e4df);
    line-height: 1.7;
}

/* ── Suggest edit button ── */
.country-panel__suggest {
    padding-top: 1rem;
    border-top: 1px solid var(--line, rgba(255,255,255,0.06));
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.country-panel__suggest-btn {
    appearance: none;
    border: 1px solid var(--line, rgba(255,255,255,0.06));
    background: var(--surface-glass, rgba(255,255,255,0.04));
    color: var(--muted, #8a857e);
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    min-height: auto;
    transition: border-color 0.15s, color 0.15s;
}
.country-panel__suggest-btn:hover {
    border-color: var(--warm, #d4a574);
    color: var(--ink, #e8e4df);
}

/* ── Suggest edit form (hidden by default) ── */
.country-panel__suggest-form {
    display: none;
    padding-top: 0.75rem;
}
.country-panel__suggest-form.active {
    display: grid;
    gap: 0.75rem;
}
.country-panel__suggest-form select,
.country-panel__suggest-form textarea {
    width: 100%;
    background: var(--surface-glass, rgba(255,255,255,0.04));
    border: 1px solid var(--line, rgba(255,255,255,0.06));
    border-radius: 10px;
    padding: 0.65rem 0.8rem;
    color: var(--ink, #e8e4df);
    font: inherit;
    font-size: 0.85rem;
}
.country-panel__suggest-form select option {
    background: var(--surface, #141a23);
}
.country-panel__suggest-submit {
    appearance: none;
    border: none;
    background: var(--teal, #5ab5b2);
    color: var(--bg, #0c0f14);
    border-radius: 999px;
    padding: 0.6rem 1.2rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    min-height: auto;
    transition: opacity 0.15s;
}
.country-panel__suggest-submit:hover { opacity: 0.88; }

/* ── Content standard footer ── */
.country-panel__footer {
    font-size: 0.72rem;
    color: var(--muted-light, #6b665f);
    line-height: 1.6;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line, rgba(255,255,255,0.06));
    font-style: italic;
}

/* ── Flag trigger button (for desk workspace) ── */
.country-flag-trigger {
    appearance: none;
    border: 1px solid var(--line, rgba(255,255,255,0.06));
    background: var(--surface-glass, rgba(255,255,255,0.04));
    border-radius: 10px;
    padding: 0.35rem 0.65rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--teal, #5ab5b2);
    min-height: auto;
    transition: border-color 0.15s, background 0.15s;
}
.country-flag-trigger:hover {
    border-color: var(--teal, #5ab5b2);
    background: var(--teal-dim, rgba(90,181,178,0.10));
}
.country-flag-trigger__icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* ── Responsive: mobile bottom sheet ── */
@media (max-width: 768px) {
    .country-panel {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
        border-left: none;
        border-top: 1px solid var(--line, rgba(255,255,255,0.06));
        box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
        transform: translateY(100%);
    }
    .country-panel.active {
        transform: translateY(0);
    }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .country-panel,
    .country-panel__backdrop {
        transition-duration: 0.01ms !important;
    }
}

/* ── RTL support ── */
[dir="rtl"] .country-panel {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 1px solid var(--line, rgba(255,255,255,0.06));
    box-shadow: 8px 0 48px rgba(0,0,0,0.5);
    transform: translateX(-460px);
}
[dir="rtl"] .country-panel.active {
    transform: translateX(0);
}
[dir="rtl"] .country-panel__close {
    right: auto;
    left: 1rem;
}
