/* Kingdom Header CSS - Converted from Tailwind for KSO_Rhapsody */

:root {
    --neutral-100: #f5f5f5;
    --neutral-300: #d4d4d4;
    --neutral-400: #a3a3a3;
    --neutral-600: #525252;
    --neutral-750: #323232;
    --neutral-550: #737373;
    --blue-600: #2563eb;
    --blue-800: #1e40af;
    --red-500: #ef4444;
}

/* Header Container */
#app-header {
    background-color: rgb(255 255 255 / 0.8);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    border-bottom: 1px solid var(--neutral-100);
    transition: all 0.3s ease-in-out;
    height: 80px; /* lg:h-20 */
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}

#app-header.is-shrunk {
    height: 56px; /* lg:h-14 */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

@media (max-width: 1023px) {
    #app-header {
        height: 56px; /* h-14 */
    }
    #app-header.is-shrunk {
        height: 40px; /* h-10 */
    }
}

.header-container {
    max-width: 1536px;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* Content Padding Transition Support */
.kso-main-content {
    transition: all 0.3s ease-in-out;
}
 
/* Search Section */
.search-toggle-wrapper {
    position: absolute;
    left: 16px;
    z-index: 50;
}

#header-search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 20px;
    color: #000;
    transition: color 0.2s;
    background: none;
    border: none;
}

#header-search-toggle:hover {
    color: var(--blue-600);
}

#header-search-toggle.is-hidden {
    display: none;
}

#header-lang-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    border: 1px solid #e5e5e5;
    background-color: #fff;
    padding: 0;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

#header-lang-toggle:hover,
#header-lang-toggle[data-state="open"] {
    transform: scale(1.08);
    border-color: #d4d4d4;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
}

.header-lang-flag {
    width: 100%;
    height: 100%;
}

.header-lang-flag.header-lang-flag-image {
    display: block;
    border-radius: 9999px;
    background-size: 120%;
    background-position: center;
    background-repeat: no-repeat;
}

.header-lang-flag.header-lang-flag-emoji {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background-color: #fff;
    font-size: 24px;
    line-height: 1;
}

@media (max-width: 767px) {
    .search-toggle-wrapper { left: 16px; }
    .header-lang-flag.header-lang-flag-emoji {
        font-size: 20px;
    }
}

#header-search-box {
    position: absolute;
    top: 50%;
    left: 100%;
    margin-left: 16px;
    transform: translateY(-50%) translateX(-16px);
    width: 288px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    background-color: #fff;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--neutral-100);
}

#header-search-box.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

#header-search-box input {
    width: 100%;
    height: 32px;
    padding: 0 8px;
    font-size: 14px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--neutral-750);
}

#header-search-box input::placeholder {
    color: var(--neutral-400);
}

body.header-lang-open {
    overflow: hidden;
}

.header-lang-layer {
    position: fixed;
    inset: 0;
    z-index: 2200;
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.header-lang-layer.active {
    display: block;
    opacity: 1;
}

.header-lang-layer-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.header-lang-layer-wrap {
    position: relative;
    z-index: 1;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    pointer-events: none;
}

.header-lang-layer-panel {
    position: relative;
    width: 100%;
    max-width: 640px;
    border-radius: 24px;
    border: 1px solid #e5e5e5;
    background: #fff;
    box-shadow: 0 28px 56px rgba(15, 23, 42, 0.3);
    padding: 28px 24px 24px;
    pointer-events: auto;
    transform: translateY(8px);
    transition: transform 0.24s ease;
}

.header-lang-layer.active .header-lang-layer-panel {
    transform: translateY(0);
}

.header-lang-layer-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: #737373;
    font-size: 38px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.header-lang-layer-close:hover {
    color: #171717;
}

#header-lang-layer-title {
    margin: 0 0 20px;
    padding-right: 44px;
    color: #262626;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
}

.header-lang-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.header-lang-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    border-radius: 14px;
    border: 1px solid rgba(23, 23, 23, 0.12);
    background: rgba(248, 250, 252, 0.9);
    color: #171717;
    text-decoration: none;
    padding: 10px 14px;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.header-lang-card:hover {
    transform: translateY(-2px);
    border-color: rgba(23, 23, 23, 0.24);
    background: #f1f5f9;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

.header-lang-card.is-current {
    border-color: rgba(23, 23, 23, 0.55);
    background: linear-gradient(120deg, rgba(226, 232, 240, 0.9) 0%, rgba(241, 245, 249, 0.95) 100%);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.14);
}

.header-lang-card-flag {
    font-size: 22px;
    line-height: 1;
}

.header-lang-card-name {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.header-lang-card-check {
    margin-left: auto;
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #171717;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
}

@media (max-width: 640px) {
    .header-lang-layer-panel {
        padding: 24px 16px 16px;
        border-radius: 20px;
    }

    #header-lang-layer-title {
        font-size: 24px;
        margin-bottom: 16px;
    }

    .header-lang-list {
        grid-template-columns: 1fr;
    }
}

/* Navigation Menus */
.nav-group-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.main-nav-list {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.main-nav-list.left { 
    justify-content: flex-end;
    margin-right: 32px;
}
.main-nav-list.right { 
    justify-content: flex-start;
    margin-left: 32px;
}

@media (max-width: 1023px) {
    .main-nav-list { display: none; }
}

.nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-link, .nav-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
    padding: 0 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--neutral-750);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    transition: all 0.2s;
    text-decoration: none;
    background: none;
    border: none;
    white-space: nowrap;
}

.nav-link:hover, .nav-btn:hover {
    color: var(--blue-600);
}

.nav-link.active {
    color: var(--blue-600);
}

.nav-item:hover .nav-link, 
.nav-item:hover .nav-btn {
    color: var(--blue-600);
}

.kingdom-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    padding: 16px;
    background-color: #fff;
    border: 1px solid var(--neutral-100);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(12px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-radius: 0 0 12px 12px;
    text-align: left;
    z-index: 1100;
}

.nav-item:hover .kingdom-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.main-nav-list.right .kingdom-dropdown {
    left: auto;
    right: 0;
}

.nav-item:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-link {
    display: block;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 8px;
    color: var(--neutral-600);
    border-radius: 6px;
    transition: all 0.2s;
    text-decoration: none;
}

.dropdown-link:hover {
    color: var(--blue-600);
    background-color: #f9fafb;
}

/* Logo */
#site-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 16px;
    position: relative;
    z-index: 40;
    flex-shrink: 0;
}

#logo-container {
    overflow: hidden;
    transition: all 0.3s ease-in-out;
    height: 56px; /* lg:h-14 */
    display: flex;
    align-items: flex-start; /* Clipping effect from top */
}

#app-header.is-shrunk #logo-container {
    height: 32px; /* lg:h-8 */
}

@media (max-width: 1023px) {
    #logo-container { height: 40px; } /* h-10 */
    #app-header.is-shrunk #logo-container { height: 24px; } /* h-6 */
}

#header-logo {
    height: 48px; /* lg:h-12 */
    width: auto;
    object-fit: cover;
    object-position: top;
}

@media (max-width: 1023px) {
    #header-logo { height: 40px; }
}


/* Auth Section */
.auth-wrapper {
    position: absolute;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    line-height:1.5;
}

@media (max-width: 1023px) {
    .auth-wrapper { right: 16px; }
}

.auth-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 14px;
    color: var(--neutral-750);
    transition: color 0.2s;
    text-decoration: none;
}

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

.auth-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    background-color: #f9fafb;
    color: var(--neutral-550);
    transition: all 0.2s;
}

.auth-icon-btn:hover {
    background-color: #fef2f2;
    color: var(--red-500);
}

.auth-divider {
    width: 1px;
    height: 12px;
    background-color: var(--neutral-300);
}

@media (max-width: 1023px) {
    .auth-link span { display: none; }
    .auth-divider { display: none; }
    .auth-link.desktop-only { display: none; }
    .auth-icon-btn.desktop-only { display: none; }
}

/* Mobile Toggle */
#mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 24px;
    color: #000;
    background-color: transparent;
    border: none;
    border-radius: 9999px;
    transition: background-color 0.2s;
    margin-left: 8px;
}

#mobile-menu-toggle:hover {
    background-color: #f9fafb;
}

@media (min-width: 1024px) {
    #mobile-menu-toggle { display: none; }
}

/* Mobile Menu Panel */
#mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    visibility: hidden;
    transition: visibility 0.3s;
}

#mobile-menu.active {
    visibility: visible;
}

#mobile-menu-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#mobile-menu.active #mobile-menu-backdrop {
    opacity: 1;
}

#mobile-menu-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 80%;
    max-width: 384px;
    height: 100%;
    background-color: #fff;
    box-shadow: -10px 0 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

#mobile-menu.active #mobile-menu-panel {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--neutral-100);
}

.mobile-nav-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.mobile-nav-item {
    line-height: 1.5;
}

.mobile-nav-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    line-height: 1.5;
}

.mobile-nav-link {
    font-size: 18px;
    font-weight: 700;
    color: var(--neutral-750);
    text-decoration: none;
}

.mobile-nav-link.active {
    color: var(--blue-600);
}

.mobile-submenu-toggle {
    padding: 8px;
    color: var(--neutral-400);
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-submenu {
    display: none;
    padding-left: 8px;
    border-left: 2px solid var(--neutral-100);
    margin-left: 4px;
    margin-top: 8px;
}

.mobile-submenu.active {
    display: block;
}

.mobile-sub-link {
    display: block;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--neutral-600);
    text-decoration: none;
    border-radius: 8px;
}

.mobile-menu-footer {
    padding: 24px;
    background-color: #f9fafb;
    border-top: 1px solid var(--neutral-100);
}

.mobile-auth-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mobile-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 12px;
    background-color: var(--blue-600);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.mobile-btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 12px;
    background-color: #fff;
    border: 1px solid var(--neutral-300);
    color: var(--neutral-750);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}
