/* Header Styles */

/* Thymeleaf fragment 루트(body 직계 flex 자식): 헤더 영역이 줄어들지 않도록 */
.client-site-header-root {
    flex-shrink: 0;
    width: 100%;
}

/* Common Header Styles */
.header-wrapper {
    background-color: var(--bg-white);}

.header-container {
    padding: 0 1rem; /* px-4 */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    color: #1f2937; /* text-gray-800 */
    font-weight: 700;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo span {
    color: var(--primary-color);
    margin-right: 0.25rem;
}

.client-header-logo-img {
    display: block;
    max-height: 2.25rem;
    max-width: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: left center;
}

.icon {
    width: 1.25rem; /* w-5 */
    height: 1.25rem; /* h-5 */
    margin-right: 0.25rem;
}

.icon-lg {
    width: 1.5rem; /* w-6 */
    height: 1.5rem; /* h-6 */
}

.menu-btn {
    background: transparent;
    color: #6b7280;
    padding: 0.5rem;
    border-radius: 0.25rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.menu-btn:hover {
    color: #374151;
}

/* Desktop Header (>= 1280px) */
.header-desktop {
    display: none;
}

.user-id-txt {
    font-weight: 600;
    color: #304e9e;
    font-size: 1rem;
}
@media (min-width: 1280px) {
    .header-desktop {
        display: block;
    }
    
    .header-desktop .header-container {
        height: 5rem; /* h-20 */
        max-width: 1280px;
        margin: 0 auto;
    }

    .header-desktop .logo {
        font-size: 1.5rem; /* text-2xl */
    }

    .header-desktop .client-header-logo-img {
        max-height: 3rem;
        max-width: 260px;
    }

    .nav-links {
        display: flex;
        gap: 2rem; /* space-x-8 */
        color: #121418; /* text-gray-600 */
        font-weight: 500;
        font-size: 1.1rem; /* text-sm */
    }

    .nav-links a:hover {
        color: var(--primary-color);
        transition: color 0.15s ease-in-out;
    }

    .header-right {
        display: flex;
        align-items: center;
        gap: 1.5rem; /* space-x-6 */
    }

    .contact-info {
        display: flex;
        align-items: center;
        color: var(--primary-color);
        font-weight: 700;
        font-size: 1.125rem; /* text-lg */
    }

    .auth-link {
        display: flex;
        align-items: center;
        color: #6b7280; /* text-gray-500 */
        font-size: 0.875rem; /* text-sm */
        transition: color 0.15s ease-in-out;
    }

    .auth-link:hover {
        color: var(--primary-color);
    }

    button.auth-link {
        padding: 0;
        border: none;
        background: transparent;
        font-family: inherit;
        cursor: pointer;
    }

    .withdraw-link {
        color: #b91c1c;
    }

    .withdraw-link:hover {
        color: #7f1d1d;
    }

    .user-id-text {
        font-size: 0.875rem;
        font-weight: 600;
        color: #4b5563;
        white-space: nowrap;
    }
}

/* Tablet Header (800px - 1279px) */
.header-tablet {
    display: none;
}

@media (min-width: 800px) and (max-width: 1279px) { /* md breakpoint */
    .header-tablet {
        display: block;
    }

    .header-tablet .header-container {
        height: 4rem; /* h-16 */
        padding: 0 1.5rem; /* px-6 */
    }

    .header-tablet .logo {
        font-size: 1.25rem; /* text-xl */
    }

    .header-tablet .client-header-logo-img {
        max-height: 2.5rem;
        max-width: 220px;
    }

    .header-tablet .contact-info {
        display: flex;
        align-items: center;
        color: var(--primary-color);
        font-weight: 700;
    }
}

/* Mobile Header (< 800px) */
.header-mobile {
    display: block;
}

@media (min-width: 800px) {
    .header-mobile {
        display: none;
    }
}

.header-mobile .header-container {
    height: 3.5rem; /* h-14 */
}

.header-mobile .logo {
    font-size: 0.875rem; /* text-sm */
}

.header-mobile .client-header-logo-img {
    max-height: 2rem;
    max-width: 160px;
}

/* Side Menu Overlay */
.side-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.48);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.side-menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Side Menu */
.side-menu {
    position: fixed;
    top: 0;
    right: calc(-1 * min(82vw, 420px));
    width: min(82vw, 420px);
    height: 100vh;
    height: 100dvh;
    background: #fff;
    z-index: 9999;
    border-radius: 24px 0 0 24px;
    box-shadow: -12px 0 40px rgba(13, 31, 61, 0.16);
    transition: right 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.side-menu.open {
    right: 0;
}

.side-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 104px;
    padding: 26px 30px 20px;
}

.side-menu-title {
    font-size: 30px;
    font-weight: 600;
    color: #101f3d;
    letter-spacing: -0.045em;
}

.side-menu-close {
    background: none;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.side-menu-close:hover {
    background: #f3f6fa;
}

.side-menu-close img {
    width: 44px;
    height: 44px;
    display: block;
    object-fit: contain;
}

.side-menu-content {
    min-height: 0;
    padding: 18px 30px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.side-menu-section-title,
.side-menu-account-title {
    margin: 0 0 14px;
    color: #7b879b;
    font-size: 14px;
    font-weight: 700;
}

.side-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.side-menu-list li {
    border-bottom: 1px solid #e8edf4;
}

.side-menu-list li:last-child {
    border-bottom: none;
}

.side-menu-list a {
    min-height: 68px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 8px 12px;
    border-radius: 12px;
    color: #102347;
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.side-menu-list a:hover {
    background-color: #f5f8fd;
    color: #1765dc;
}

.side-menu-list a.is-active {
    background: #edf4ff;
    color: #1765dc;
}

.side-menu-item-icon {
    width: 46px;
    height: 46px;
    display: block;
    object-fit: contain;
}

.side-menu-chevron {
    color: #6c7a92;
    font: 400 32px/1 Arial, sans-serif;
}

.side-menu-link.is-active .side-menu-chevron {
    color: #1765dc;
}

/* Side Menu Footer (Login/Logout) */
.side-menu-footer {
    padding: 20px 30px calc(24px + env(safe-area-inset-bottom));
    margin-top: auto;
}

.side-menu-auth-btn {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.side-menu-login-btn {
    background-color: #fff;
    color: #5f6f87;
    border: 1px solid #cfd8e6;
}

.side-menu-login-btn:hover {
    background-color: #f7f9fc;
}

.side-menu-logout-btn {
    background-color: #fff;
    color: #5f6f87;
    border: 1px solid #cfd8e6;
    font-family: inherit;
}

.side-menu-logout-btn:hover {
    background-color: #f7f9fc;
}

.side-menu-auth-btn img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.side-menu-withdraw-btn {
    margin-top: 0.5rem;
    background-color: #fff;
    color: #b91c1c;
    border: 1px solid #fecaca;
    font-family: inherit;
}

.side-menu-withdraw-btn:hover {
    background-color: #fef2f2;
}

@media (max-width: 430px) {
    .side-menu { width: 84vw; right: -84vw; border-radius: 20px 0 0 20px; }
    .side-menu-header { min-height: 88px; padding: 22px 22px 16px; }
    .side-menu-title { font-size: 20px; }
    .side-menu-content { padding: 14px 22px 0; }
    .side-menu-list a { min-height: 62px; font-size: 16px; }
    .side-menu-footer { padding: 18px 22px calc(20px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
    .side-menu,
    .side-menu-overlay { transition-duration: 0.01ms; }
}

/* KRMA nationwide identity */
.client-site-header-root { --primary-color: #ec0718; }
.krma-wordmark { display: inline-flex; align-items: baseline; white-space: nowrap; letter-spacing: -1.7px; font-size: 27px; line-height: 1.15; }
.logo .krma-wordmark { margin: 0; color: #111820; }
.krma-wordmark strong { color: #ed0a1b; font-weight: 900; }
.krma-wordmark b { color: #111820; font-weight: 900; }
.client-site-header-root .header-wrapper { background: #fff; border-bottom: 1px solid #f1f2f4; }
.client-site-header-root .nav-links { font-weight: 750; gap: 30px; font-size: 17px; }
.client-site-header-root .nav-links a { position: relative; padding: 32px 0; color: #151a22; text-decoration: none; }
.client-site-header-root .nav-links a.is-active { color: #ec0718; }
.client-site-header-root .nav-links a.is-active::after { position: absolute; content: ''; left: 0; right: 0; bottom: 15px; height: 2px; background: #ec0718; }
.client-site-header-root .nav-links a:hover { color: #ec0718; }
.client-site-header-root .header-right { gap: 16px; }
.client-site-header-root .auth-link { color: #747a85; font-size: 14px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.client-site-header-root .auth-link .icon { display: none; }
.client-site-header-root .signup-link { padding-left: 16px; border-left: 1px solid #e2e4e8; }
.krma-quick-consult { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 13px 20px; border-radius: 28px; color: #fff; background: #ec0718; font-size: 15px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.krma-quick-consult span { font-size: 21px; line-height: 1; }
.krma-quick-consult:hover { background: #ce0615; color: #fff; }
.client-site-header-root .user-id-txt { color: #ec0718; }
.client-site-header-root .menu-btn { color: #19212b; }
.client-site-header-root .side-menu-link.active { color: #ec0718; background-color: #fff3f4; }
.client-site-header-root a:focus-visible, .client-site-header-root button:focus-visible { outline: 3px solid #e80a1c; outline-offset: 4px; }
@media (min-width: 1280px) {
    .client-site-header-root .header-desktop .header-container { height: 100px; max-width: 1440px; padding: 0 42px; gap: 28px; }
    .client-site-header-root .header-desktop-menu-btn { display: none; }
}
@media (min-width: 768px) and (max-width: 1279px) {
    .client-site-header-root .header-tablet .header-container { max-width: 1440px; margin: auto; padding: 0 32px; height: 82px; flex-direction: row-reverse; }
}
@media (max-width: 767px) {
    .krma-wordmark { font-size: 22px; letter-spacing: -1.3px; }
    .client-site-header-root .header-mobile .header-container { height: 72px; padding: 0 20px; }
}
.nav-service-pending {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #737985;
    cursor: default;
    white-space: nowrap;
}
.nav-service-pending small {
    border-radius: 4px;
    background: #f1f3f5;
    padding: 3px 5px;
    color: #626975;
    font-size: 10px;
    font-weight: 500;
}
.side-menu .nav-service-pending {
    display: flex;
    min-height: 62px;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    font-size: 16px;
    border-bottom: 1px solid #edf0f3;
}
