/* ===================================
   Ubden Games — app shell theme
   Loaded after style.css on every logged-in / auth page.
   Aligns the app with the landing page: night sky, glass header, white panels.
   =================================== */

:root {
    --night: #0b1030;
    --night-2: #161046;
    --gold: #e9c46a;
    --gold-light: #fff0bd;
    --gradient-gold: linear-gradient(135deg, #fff0bd 0%, #e9c46a 55%, #c9973a 100%);
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

html {
    background: var(--night);
}

body {
    background: var(--night);
    color: var(--dark);
    min-height: 100vh;
    min-height: 100dvh;
}

/* Fixed backdrop layer (position:fixed instead of background-attachment:fixed, which iOS ignores) */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56'%3E%3Cpath d='M28 22l4 6-4 6-4-6z' fill='%23e9c46a' fill-opacity='.06'/%3E%3C/svg%3E"),
        radial-gradient(900px 600px at 85% 0%, rgba(124, 58, 237, 0.45), transparent 60%),
        radial-gradient(700px 500px at 0% 100%, rgba(236, 72, 153, 0.22), transparent 60%),
        linear-gradient(160deg, var(--night) 0%, var(--night-2) 55%, #1d0f3d 100%);
}

#app-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s ease;
}

#app-bg.is-ready {
    opacity: 1;
}

.site-header,
.main-content,
.site-footer {
    position: relative;
    z-index: 1;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 2000;
    background: #fff;
    color: var(--primary-dark);
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    top: 12px;
}

:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(11, 16, 48, 0.72);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
    padding: calc(10px + env(safe-area-inset-top)) 0 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow: visible;
}

.site-header .header-background {
    display: none;
}

.site-header .container {
    flex-wrap: nowrap;
    gap: 12px;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

.site-header .branding {
    min-width: 0;
}

.logo-text {
    flex-direction: row;
    align-items: center;
    gap: 14px;
}

.logo-image {
    height: 46px;
}

.site-header .tagline {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid rgba(233, 196, 106, 0.35);
    background: rgba(233, 196, 106, 0.08);
    color: var(--gold-light);
    white-space: nowrap;
}

.site-header .language-selector {
    margin-left: 0;
    flex-shrink: 0;
}

.language-icon {
    display: none;
}

.language-dropdown {
    min-height: 44px;
    padding: 8px 34px 8px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    font: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: background-color 0.2s, border-color 0.2s;
}

.language-dropdown:hover {
    background-color: rgba(255, 255, 255, 0.18);
    border-color: #fff;
}

.language-dropdown option {
    color: var(--dark);
}

/* ---------- Main ---------- */
.main-content {
    padding: 36px 0 24px;
}

/* ---------- Panels ---------- */
.card {
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(5, 8, 30, 0.45);
}

.card:hover {
    transform: none;
}

.card-header {
    border-bottom-color: #eef2f7;
}

/* ---------- Forms ---------- */
.form-input,
.form-select {
    min-height: 48px;
    font-size: 16px; /* prevents iOS zoom on focus */
    border-radius: 14px;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
    outline: none;
}

.input-wrap {
    position: relative;
}

.input-wrap .form-input {
    padding-right: 52px;
}

.input-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--gray);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.input-toggle:hover {
    color: var(--primary);
    background: var(--gray-lighter);
}

.input-toggle .eye-off {
    display: none;
}

.input-toggle[aria-pressed='true'] .eye-on {
    display: none;
}

.input-toggle[aria-pressed='true'] .eye-off {
    display: block;
}

.btn:active {
    transform: scale(0.98);
}

/* ---------- Auth pages ---------- */
.auth-card {
    max-width: 440px;
    margin: 12px auto 24px;
    padding: 32px 28px 28px;
    animation: auth-in 0.7s var(--ease) both;
}

@keyframes auth-in {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.auth-mark {
    width: 84px;
    height: 84px;
    margin: -64px auto 14px;
    padding: 10px;
    border-radius: 24px;
    background: linear-gradient(180deg, #1b2150, #0d1030);
    box-shadow: 0 14px 30px rgba(5, 8, 30, 0.45), 0 0 0 4px #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-mark img {
    width: 100%;
    height: 100%;
    display: block;
}

.auth-card .card-header {
    text-align: center;
    border-bottom: 0;
    padding-bottom: 4px;
}

.auth-card .card-title {
    font-size: 1.6rem;
}

/* ---------- Dashboard ---------- */
.dashboard-container .welcome-section h1 {
    color: #fff;
}

.dashboard-container .welcome-section p {
    color: rgba(255, 255, 255, 0.78);
}

.welcome-avatar {
    background: linear-gradient(180deg, #1b2150, #0d1030) !important;
    box-shadow: 0 16px 36px rgba(5, 8, 30, 0.5), 0 0 0 4px rgba(233, 196, 106, 0.55) !important;
    padding: 14px;
}

.welcome-avatar img {
    width: 100%;
    height: 100%;
    display: block;
}

.action-card {
    position: relative;
    overflow: hidden;
    border-radius: 24px !important;
    border-color: transparent !important;
    box-shadow: 0 24px 60px rgba(5, 8, 30, 0.4) !important;
}

.action-card,
.action-card.primary {
    background: linear-gradient(135deg, #ffffff 0%, #f1f3ff 100%) !important;
}

.action-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 0%), rgba(99, 102, 241, 0.16), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.action-card .action-icon {
    color: #fff;
    box-shadow: 0 12px 26px rgba(99, 102, 241, 0.4);
}

.action-card .action-icon svg {
    width: 40px;
    height: 40px;
}

.action-card.secondary .action-icon {
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.35);
}

.action-card.primary .action-icon {
    animation: action-bob 4s ease-in-out infinite;
}

@keyframes action-bob {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-5px) rotate(-4deg); }
}

@media (hover: hover) {
    .action-card:hover {
        transform: translateY(-6px) !important;
    }
    .action-card:hover::before {
        opacity: 1;
    }
}

.profile-card {
    border-radius: 24px !important;
    box-shadow: 0 24px 60px rgba(5, 8, 30, 0.4) !important;
}

/* ---------- Footer ---------- */
.site-footer {
    margin-top: 40px;
    background: rgba(11, 16, 48, 0.78);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: calc(26px + env(safe-area-inset-bottom));
}

.site-footer .footer-background {
    display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    /* keep logo + language on one row (style.css stacks them) */
    .site-header .container {
        flex-direction: row;
        text-align: left;
    }
    .site-header .language-selector {
        margin-top: 0;
    }
}

@media (max-width: 640px) {
    .main-content {
        padding: 24px 0 16px;
    }
    .logo-image {
        height: 38px;
    }
    .site-header .tagline {
        display: none;
    }
    .auth-card {
        margin-top: 44px;
        padding: 28px 20px 22px;
    }
    .dashboard-container {
        margin-top: 12px !important;
    }
}

@media (max-width: 360px) {
    .logo-image {
        height: 32px;
    }
    .language-dropdown {
        padding-left: 10px;
        font-size: 0.82rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
