/* ==========================================================
   디자인 다듬기 공용 스타일 (모든 페이지 공통)
   각 페이지의 인라인 스타일 뒤, mobile-header.css 앞에서 불러온다.
   컴퓨터 전용은 min-width:801px 안에 있다.
   ========================================================== */

/* ---- 1. 로그인 / 회원가입 / 비밀번호 재설정 폼 ---- */
.container label,
.register-container .form-group label {
    display: block;
    margin: 18px 0 8px;
    color: #374151;
    font-size: 14px;
    font-weight: 700;
}
.container input,
.register-container .form-group input,
.register-container .form-group select {
    border: 1.5px solid #d5dde7;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.container input:focus,
.register-container .form-group input:focus,
.register-container .form-group select:focus {
    outline: none;
    border-color: #2d6cc0;
    box-shadow: 0 0 0 4px rgba(45, 108, 192, .15);
}
.login-button,
.register-button {
    box-shadow: 0 6px 16px rgba(45, 108, 192, .28);
    transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
}
.login-button:hover:not(:disabled),
.register-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(45, 108, 192, .35);
}
.login-button:active:not(:disabled),
.register-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(45, 108, 192, .3);
}

/* ---- 4. 언어 선택 (모양 통일) ---- */
.language-select {
    padding: 10px 38px 10px 15px;
    border: 1px solid #d5dde7;
    border-radius: 10px;
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 14 9'><path d='M1 1l6 6 6-6' fill='none' stroke='%23506070' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 14px center;
    color: #1f2937;
    font-weight: 700;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.language-select:hover { border-color: #9db7d8; }
.language-select:focus {
    outline: none;
    border-color: #2d6cc0;
    box-shadow: 0 0 0 4px rgba(45, 108, 192, .15);
}

/* 버튼을 누르는 느낌 */
.account-btn { transition: transform .12s ease, box-shadow .15s ease, background .15s ease; }
.account-btn:active { transform: scale(.97); }

/* ---- 4. 스크롤 때 카드가 부드럽게 나타남 (polish.js 가 클래스를 붙였다 뗀다) ---- */
.rv { opacity: 0; }
.rv.in { animation: rvIn .55s ease both; }
@keyframes rvIn {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .rv { opacity: 1; }
    .rv.in { animation: none; }
}

/* ---- 3. 오른쪽 퀵메뉴: 맨 위에서는 숨기고 스크롤하면 나타남 ---- */
.quick-menu {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .3s ease, visibility .3s ease;
}
body.qm-show:not(.qm-end) .quick-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ---- 2. 나라 페이지 상단 ---- */
/* 사진 위 어두운 그라데이션 + 흰 글씨 */
.country-page .hero { position: relative; overflow: hidden; isolation: isolate; }
/* 사진 층: 아주 느리게 확대 (배경 사진을 그대로 물려받아 따로 지정하지 않는다) */
.country-page .hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background: inherit;
    animation: stKenBurns 18s ease-in-out infinite alternate;
}
@keyframes stKenBurns {
    from { transform: scale(1); }
    to   { transform: scale(1.12) translate(-1.5%, -1%); }
}
.country-page .hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(10, 25, 50, .22), rgba(10, 25, 50, .62));
}
.country-page .hero .hero-text {
    position: relative;
    background: transparent !important;
}
.country-page .hero h1 {
    color: #fff !important;
    letter-spacing: -1px;
    text-shadow: 0 2px 14px rgba(0, 0, 0, .5) !important;
}
.country-page .hero p {
    color: rgba(255, 255, 255, .95) !important;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .5) !important;
}


/* 아래는 컴퓨터 전용 */
@media (min-width: 801px) {

    /* 메뉴 사이 구분선: 굵은 막대 -> 얇은 회색선 */
    nav a:not(:last-child)::after {
        width: 1px !important;
        height: 14px !important;
        background: #d5dde7 !important;
    }

    /* 로그인 줄: 회색 띠를 없애고 헤더와 메뉴 사이를 가볍게 */
    .account-bar {
        background: #fff !important;
        padding-top: 8px !important;
        padding-bottom: 0 !important;
    }
}

/* 회원가입 국적 선택 목록도 같은 모양으로 */
.register-container .form-group select {
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 14 9'><path d='M1 1l6 6 6-6' fill='none' stroke='%23506070' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 16px center;
    padding-right: 40px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* 폰: 언어 선택이 좁아서 화살표가 글자와 겹치지 않게 */
@media (max-width: 600px) {
    .language-select {
        padding: 8px 26px 8px 10px;
        background-position: right 9px center;
        font-size: 13px;
    }
}


/* ==========================================================
   효과 모음 (토스트, 진행 막대, 구역 강조, 하트, 말풍선, 카드, 긴급번호, 스켈레톤)
   ========================================================== */

/* 토스트 */
.st-toasts {
    position: fixed;
    left: 50%;
    bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 2147483000;
    display: grid;
    gap: 8px;
    width: min(92vw, 380px);
    pointer-events: none;
}
.st-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-radius: 12px;
    background: #17233a;
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
    animation: stToastIn .3s ease-out;
    transition: opacity .3s ease, transform .3s ease;
    pointer-events: auto;
    cursor: pointer;
}
.st-toast.out { opacity: 0; transform: translateY(10px); }
.st-toast-tx { white-space: pre-line; word-break: keep-all; }
.st-toast-ic {
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 800;
    color: #0e1a2e;
}
.st-toast-ic.ok { background: #6be3a4; }
.st-toast-ic.warn { background: #ffc266; }
@keyframes stToastIn { from { opacity: 0; transform: translateY(14px); } }

/* 스크롤 진행 막대 */
.st-progress {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 5px;
    z-index: 2147482000;
    box-shadow: 0 1px 8px rgba(45, 108, 192, .55);
    transform: scaleX(0);
    transform-origin: 0 50%;
    background: linear-gradient(90deg, #2d6cc0, #5aa0f0);
    pointer-events: none;
}

/* 지금 보고 있는 구역 */
nav a.st-active {
    font-weight: 800;
    text-decoration: underline;
    text-decoration-thickness: 3px;
    text-underline-offset: 9px;
}
.quick-menu-link.st-active { background: #dbe8fa !important; font-weight: 800; }

/* 하트 효과 */
.st-spark {
    position: fixed;
    width: 7px;
    height: 7px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: #ff5d8f;
    z-index: 2147483000;
    pointer-events: none;
    animation: stSpark .65s ease-out forwards;
}
@keyframes stSpark { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
.country-favorite-btn:active { transform: scale(.95); }

/* 퀵메뉴 말풍선, 마스코트 손 흔들기 */
.quick-menu { overflow: visible; }
.qm-bubble {
    position: absolute;
    right: calc(100% + 6px);
    top: 14px;
    width: max-content;
    max-width: 190px;
    padding: 9px 13px;
    border-radius: 14px 14px 4px 14px;
    background: #fff;
    color: #1f2937;
    border: 1px solid #dbe3ee;
    box-shadow: 0 8px 20px rgba(20, 40, 90, .18);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
    word-break: keep-all;
    opacity: 0;
    transform: translateY(6px) scale(.96);
    transition: opacity .35s ease, transform .35s ease;
    pointer-events: none;
}
.qm-bubble.on { opacity: 1; transform: none; }
.quick-mascot.st-wave { animation: stWave .8s ease-in-out; transform-origin: 50% 90%; }
@keyframes stWave {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(-9deg); }
    50% { transform: rotate(7deg); }
    80% { transform: rotate(-4deg); }
}

/* 메인 국가 카드: 사진 확대 층 (카드의 배경 사진을 물려받음) */
.country-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: inherit;
    z-index: 0;
    transition: transform .6s ease;
}
.country-card:hover::after { transform: scale(1.08); }

/* 긴급 연락처 번호: 맥동 */
.emergency-card .emergency-call { animation: stRing 1.8s ease-out infinite; }
.emergency-card .emergency-call:hover,
.emergency-card .emergency-call:focus-visible { animation: none; }
@keyframes stRing {
    0% { box-shadow: 0 0 0 0 rgba(27, 90, 166, .6); }
    70%, 100% { box-shadow: 0 0 0 20px rgba(27, 90, 166, 0); }
}

/* 외교부 안전등급 불러오는 동안 스켈레톤 */
#mofa-live .sk {
    height: 16px;
    border-radius: 8px;
    background: linear-gradient(90deg, #e6edf6 25%, #f3f7fc 50%, #e6edf6 75%);
    background-size: 200% 100%;
    animation: stShimmer 1.2s linear infinite;
}
@keyframes stShimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
    .country-page .hero::after, .emergency-card .emergency-call, #mofa-live .sk { animation: none; }
}

/* 폰: 말풍선은 작게, 토스트는 하단 퀵메뉴 마스코트를 피해 중앙 */
@media (max-width: 800px) {
    .qm-bubble { max-width: 150px; font-size: 12px; padding: 7px 10px; top: 8px; }
}

/* 나라 페이지 메뉴: 스크롤해도 화면 위에 붙어 있어 지금 보는 구역 이름이 항상 보인다 */
.country-page nav {
    position: sticky;
    top: 0;
    z-index: 1500;
    padding-top: 14px;
    padding-bottom: 14px;
    box-shadow: 0 3px 12px rgba(20, 40, 90, .08);
}
@media (max-width: 800px) {
    .country-page nav {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        row-gap: 0;
        padding: 10px 6px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .country-page nav::-webkit-scrollbar { display: none; }
    .country-page nav a {
        flex: none;
        padding: 0 12px;
        font-size: 14px;
        white-space: nowrap;
    }
    .country-page nav a:not(:last-child)::after { width: 1px; height: 14px; }
}

/* 안전등급 / 긴급 연락처 / 위급 상황 문구: 빈 공간을 늘리지 않고 요소 자체를 키운다.
   가로는 지도·페이지 소개와 같은 내용 폭(1050px)에 맞춘다 (컴퓨터 화면만) */
@media (min-width: 801px) {
    .country-page nav a { padding: 0 22px; }   /* 메뉴 항목이 6개로 늘어 간격을 조금 줄인다 */

    /* 안전등급 카드 */
    .country-page .level-grid { gap: 22px; }
    .country-page .level-card { padding: 54px 22px; }
    .country-page .level-card h3 { font-size: 30px; margin-bottom: 14px; }
    .country-page .level-card p { font-size: 17px; line-height: 1.5; }

    /* 긴급 연락처 카드 */
    .country-page .emergency-grid { gap: 24px; }
    .country-page .emergency-card { padding: 46px 30px; }
    .country-page .emergency-card h3 { font-size: 26px; margin-bottom: 14px; }
    .country-page .emergency-card .emergency-call { font-size: 34px; padding: 14px 34px; margin-top: 8px; }
    .country-page .emergency-card .emergency-call--long { font-size: 22px; padding: 12px 20px; }
    .country-page .emergency-card .emergency-note { font-size: 15px; margin-top: 12px; }

    /* 위급 상황 문구: 카드 영역을 다른 구역과 같은 폭으로, 카드는 더 크게 */
    .country-page .phrase-grid { max-width: none; width: 100%; gap: 22px; }
    .country-page .phrase-lead { font-size: 17px; max-width: 820px; margin-bottom: 30px; }
    .country-page .phrase-lang { font-size: 17px; }
    .country-page .phrase-card { padding: 34px 30px; gap: 10px; min-height: 170px; justify-content: center; }
    .country-page .phrase-meaning { font-size: 17px; }
    .country-page .phrase-local { font-size: 30px; }
    .country-page .phrase-read { font-size: 15px; }
}

/* 퀵메뉴 항목이 6개라 낮은 화면에서는 조금 촘촘하게 */
@media (min-width: 801px) and (max-height: 760px) {
    .quick-menu-link { min-height: 38px; margin-bottom: 6px; padding: 5px; font-size: 13px; }
    .quick-menu-panel { padding-top: 20px; }
}

/* 태블릿 폭(801~1100px)에서 '페이지 소개' 2단 배치(300px+650px 고정)가 가로로 넘치던 문제 방지 */
@media (min-width: 801px) and (max-width: 1100px) {
    .country-page .service-intro-top {
        grid-template-columns: minmax(0, 300px) minmax(0, 650px);
        padding-left: 12px;
        padding-right: 12px;
    }
    .country-page .service-intro-character { max-width: 100%; transform: none; }
}


/* ==========================================================
   퀵메뉴: 접이식 + 오른쪽 아래에 붙임 (컴퓨터 화면)
   - 캐릭터만 보이고, 아래 '메뉴' 버튼으로 메뉴를 열고 닫는다. 열면 위로 자라서 화면 안에 머문다.
   - 폰(800px 이하)은 기존 작은 캐릭터 그대로이며 이 버튼은 숨긴다.
   ========================================================== */
.qm-toggle { display: none; }
@media (min-width: 801px) {
    .quick-menu {
        top: auto !important;
        bottom: 22px;
        transform: translateY(var(--quick-float-y, 0px)) !important;
    }
    .qm-toggle {
        display: block;
        margin: 8px auto 0;
        padding: 7px 16px;
        border: 1px solid #dbe6f3;
        border-radius: 999px;
        background: rgba(255, 255, 255, .97);
        color: #25374a;
        font: inherit;
        font-size: 13px;
        font-weight: 800;
        box-shadow: 0 4px 12px rgba(20, 40, 90, .14);
        cursor: pointer;
        transition: background .15s ease, color .15s ease;
    }
    .qm-toggle:hover { background: #25374a; color: #fff; }
    .quick-menu:not(.qm-open) .quick-menu-panel { display: none; }
    .quick-menu.qm-open .quick-menu-panel { margin-top: 10px; animation: stPanelIn .25s ease-out; }
    .qm-bubble { top: 4px; }
}
@keyframes stPanelIn { from { opacity: 0; transform: translateY(8px); } }

/* ==========================================================
   긴급 연락처 카드 정렬 (번호가 2개/긴 번호여도 카드 안에서 가운데에 반듯하게)
   ========================================================== */
.emergency-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
}
.emergency-card p:has(.emergency-call) {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    max-width: 100%;
}
.emergency-card .emergency-call + .emergency-call { margin-left: 0; }
.emergency-card .emergency-call { max-width: 100%; box-sizing: border-box; }
@media (min-width: 801px) {
    .country-page .emergency-card .emergency-call { font-size: clamp(24px, 2.4vw, 32px); padding: 12px clamp(18px, 2vw, 30px); }
    .country-page .emergency-card .emergency-call--long { font-size: clamp(16px, 1.7vw, 21px); padding: 12px clamp(14px, 1.4vw, 20px); white-space: nowrap; }
}
@keyframes stRing {
    0% { box-shadow: 0 0 0 0 rgba(27, 90, 166, .55); }
    70%, 100% { box-shadow: 0 0 0 12px rgba(27, 90, 166, 0); }
}

/* 번호가 2개인 카드(베트남 화재 114 · 구급 115): 나란히 한 줄에 놓이게 조금 작게 */
@media (min-width: 801px) {
    .country-page .emergency-card { padding-left: 18px; padding-right: 18px; }
    .country-page .emergency-card p:has(.emergency-call ~ .emergency-call) { flex-wrap: nowrap; gap: 10px; }
    .country-page .emergency-card p:has(.emergency-call ~ .emergency-call) .emergency-call {
        font-size: clamp(20px, 2vw, 26px);
        padding: 10px clamp(12px, 1.3vw, 18px);
    }
}
