/* ========================================================
   GLOBAL COMPONENT CONFIGURATIONS & THEME ENGINE (MD3)
   HIGH CONTRAST PREMIUM LIGHT & PURE BLACK THEME MATRIX
   ======================================================== */
:root {
    --bg-color: #FFFFFF; 
    --surface: #FFFFFF; 
    --primary: #FF2E55; 
    --primary-glow: rgba(255, 46, 85, 0.12);
    --text-main: #000000; 
    --text-muted: #555555; 
    --card-bg: #FFFFFF;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(0, 0, 0, 0.08);
    --success: #00C853;
    --download: #007AFF;
    --border-color: #EEEEEE;
}

[data-theme="dark"] {
    --bg-color: #000000;
    --surface: #000000;
    --primary: #FF3B30;
    --primary-glow: rgba(255, 59, 48, 0.15);
    --text-main: #FFFFFF;
    --text-muted: #AAAAAA;
    --card-bg: #111111;
    --glass-bg: rgba(0, 0, 0, 0.95);
    --glass-border: rgba(255, 255, 255, 0.1);
    --border-color: #222222;
}

* { 
    box-sizing: border-box; 
    font-family: 'Plus Jakarta Sans', sans-serif; 
    -webkit-tap-highlight-color: transparent; 
    -webkit-touch-callout: none; 
    -webkit-user-select: none; 
    user-select: none; 
    -webkit-user-drag: none; 
}

input, textarea, select { 
    -webkit-user-select: auto; 
    user-select: auto; 
}

body { 
    margin: 0; 
    background-color: var(--bg-color); 
    color: var(--text-main); 
    overflow-x: hidden; 
    padding-top: 82px; /* Positioned directly to match lowered header height */
    padding-bottom: 48px; 
    touch-action: pan-y; 
    transition: background-color 0.3s; 
}

body.auth-active { 
    overflow: hidden; 
    height: 100vh; 
}

::-webkit-scrollbar { 
    display: none; 
}

/* LOADING / SPLASH SCREEN */
#splash-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: radial-gradient(circle at center, #ffffff 0%, #f1f5f9 100%);
    display: flex; justify-content: center; align-items: center;
    z-index: 999999;
    transition: opacity 0.6s ease;
}

.ambient-light {
    position: absolute;
    width: 300px; height: 300px;
    background: rgba(191, 149, 63, 0.12);
    border-radius: 50%;
    filter: blur(80px);
    animation: pulse 4s infinite alternate;
}

.loading-container { 
    text-align: center; 
    z-index: 2; 
}

.logo-splash {
    font-family: 'Cinzel', serif;
    font-size: 3.5rem; letter-spacing: 2px;
    color: #1e293b; opacity: 0; margin: 0 0 20px 0;
    animation: fadeUp 1.5s ease-out forwards;
    text-shadow: 0px 5px 15px rgba(0, 0, 0, 0.05);
}

.logo-splash span { 
    background: linear-gradient(to right, #bf953f, #b38728, #aa771c); 
    -webkit-background-clip: text; 
    color: transparent; 
    font-weight: 800; 
}

.progress-container {
    width: 250px; height: 4px;
    background: rgba(0, 0, 0, 0.06);
    margin: 0 auto 15px auto; border-radius: 10px;
    overflow: hidden; opacity: 0;
    animation: fadeIn 1s ease-out 1s forwards;
    position: relative;
}

.progress-bar { 
    width: 0%; height: 100%; 
    background: linear-gradient(90deg, #bf953f, #b38728); 
    border-radius: 10px; 
    animation: loadProgress 3.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; 
}

.loading-text { 
    color: #64748b; 
    font-size: 0.9rem; 
    letter-spacing: 3px; 
    text-transform: uppercase; 
    opacity: 0; 
    margin: 0; 
    animation: fadeIn 1s ease-out 1.5s forwards; 
}

@keyframes fadeUp { 
    0% { opacity: 0; transform: translateY(30px) scale(0.9); } 
    100% { opacity: 1; transform: translateY(0) scale(1); } 
}

@keyframes fadeIn { 
    0% { opacity: 0; } 
    100% { opacity: 1; } 
}

@keyframes loadProgress { 
    0% { width: 0%; } 
    40% { width: 45%; } 
    70% { width: 80%; } 
    100% { width: 100%; } 
}

@keyframes pulse { 
    0% { transform: scale(1); opacity: 0.5; } 
    100% { transform: scale(1.5); opacity: 1; } 
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    gap: 10px;
}
.toast {
    background: var(--surface);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--primary);
    color: var(--text-main);
    padding: 12px 20px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    animation: slideDownIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    line-height: 1.3;
    pointer-events: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90vw;
}
.toast span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 75vw;
}
.toast.success { border-left-color: var(--success); }
@keyframes slideDownIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes slideOutUp {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-50px); opacity: 0; }
}

/* Auth Screen */
#auth-screen { 
    position: fixed; top: 0; left: 0;
    width: 100vw; height: 100vh; overflow: hidden; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    background: linear-gradient(to top, rgba(255,255,255,1) 0%, rgba(255,255,255,0.7) 100%), url('https://assets.nflxext.com/ffe/siteui/vlv3/f841d4c7-10e1-40af-bcae-07a3f8dc141a/f6d7434e-d6de-4185-a6d4-c77a2d08737b/US-en-20220502-popsignuptwoweeks-perspective_alpha_website_small.jpg') center/cover; 
    padding: 16px; box-sizing: border-box;
}
.auth-box { 
    background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(30px); 
    border: 1px solid var(--glass-border); box-shadow: 0 20px 40px rgba(0,0,0,0.05); 
    padding: 35px 24px; border-radius: 32px; width: 100%; max-width: 420px; max-height: 90vh;
    overflow-y: auto; scrollbar-width: none; animation: scaleFadeIn 0.6s ease; 
}
.auth-box::-webkit-scrollbar { display: none; }
.auth-box h1 { color: var(--text-main); text-align: center; font-size: 2.2rem; margin: 0 0 5px 0; font-weight: 900; }
.auth-box h1 span { color: var(--primary); }
.auth-box h2 { text-align: center; margin: 0 0 25px 0; font-weight: 500; color: var(--text-muted); font-size: 1rem; }

.btn-google { width: 100%; padding: 18px; background: white; color: #000000; border: 1px solid rgba(0,0,0,0.08); border-radius: 18px; font-size: 1.05rem; font-weight: 800; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; gap: 12px; box-shadow: 0 5px 15px rgba(0,0,0,0.03); }
.btn-google img { width: 22px; }
@keyframes scaleFadeIn { 0% { opacity: 0; transform: scale(0.95); } 100% { opacity: 1; transform: scale(1); } }

/* App Layout & Header Spacing */
#app-screen { display: none; position: relative; }
header { 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; 
    height: 82px; /* Increased height to avoid status bar overlap */
    padding-top: 32px; /* Lowered header contents below status bar */
    background: var(--surface); 
    padding-left: 16px;
    padding-right: 16px;
    z-index: 100; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid var(--border-color); 
}

.brand { color: var(--text-main); font-size: 1.3rem; font-weight: 900; margin: 0; display: flex; align-items: center; gap: 8px; }
.brand span { color: var(--primary); }
.header-avatar { width: 32px; height: 32px; background: linear-gradient(135deg, var(--primary), #FF7A00); color: white; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.85rem; cursor: pointer; overflow: hidden; border: 1px solid rgba(0,0,0,0.05); }
.header-avatar img { width: 100%; height: 100%; object-fit: cover;}

/* Account Switch Header Button */
.btn-switch-account-header {
    background: var(--surface); border: 1px solid var(--glass-border);
    padding: 8px 16px; border-radius: 20px; font-size: 0.85rem; font-weight: 700;
    color: var(--text-main); cursor: pointer; display: flex; align-items: center; gap: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02); transition: all 0.2s ease;
}
.btn-switch-account-header:active { transform: scale(0.95); background: var(--border-color); }

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 48px; 
    background: #FFFFFF !important;
    border-top: 1px solid #EEEEEE;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: none !important;
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: border-box;
}

.nav-item {
    color: #666666;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    position: relative;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent !important;
    transition: none !important; 
}

.nav-item:active, .nav-item:focus, .nav-create-circle:active, .nav-create-circle:focus {
    background-color: transparent !important;
    background: transparent !important;
    transform: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.nav-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px; 
    height: 26px;
    position: relative;
    transition: none !important;
}
.nav-item:active .nav-icon-container {
    transform: none !important;
}

.nav-icon-svg {
    width: 26px !important; 
    height: 26px !important;
    fill: none;
    color: #000000 !important; 
    opacity: 0.54; 
    transition: opacity 0.15s ease;
}

.nav-item.active .nav-icon-svg {
    opacity: 1 !important; 
}

.nav-label {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px; 
    font-weight: 700;
    color: #000000 !important; 
    opacity: 0.54; 
    margin-top: 2px;
    letter-spacing: -0.15px;
    transition: opacity 0.1s ease;
}

.nav-item.active .nav-label {
    opacity: 1 !important;
    font-weight: 800;
}

.nav-create-circle {
    background-color: #F1F5F9;
    color: #000000;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: none !important;
}

.nav-create-circle:active {
    transform: none !important;
    background-color: #F1F5F9 !important; 
}

.nav-create-circle svg {
    width: 20px;
    height: 20px;
    color: #000000;
}

.nav-avatar-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nav-item.active .nav-avatar-circle {
    border-color: #000000;
}

.nav-item .icon-selected { display: none !important; }
.nav-item .icon-unselected { display: block !important; }
.nav-item.active .icon-selected { display: block !important; }
.nav-item.active .icon-unselected { display: none !important; }

.nav-avatar-wrap { width: 22px; height: 22px; border-radius: 50%; overflow: hidden; border: 2px solid transparent; transition: border-color 0.1s ease; display: flex; align-items: center; justify-content: center; }
.nav-item.active .nav-avatar-wrap { border-color: #000000; }
.nav-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }

/* General Inputs */
.sheet-input, .sheet-textarea, .sheet-select { width: 100%; padding: 14px 16px; border: 1px solid rgba(0,0,0,0.08); border-radius: 14px; background: var(--bg-color); color: var(--text-main); font-size: 0.95rem; outline: none; margin-bottom: 16px; transition: 0.3s; }
.sheet-input:focus, .sheet-textarea:focus, .sheet-select:focus { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 4px rgba(255,46,85,0.08); }
.sheet-textarea { resize: none; height: 100px; }

.upload-badge-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.upload-badge { padding: 6px 12px; background: var(--bg-color); border-radius: 10px; font-size: 0.8rem; font-weight: 700; color: var(--text-muted); cursor: pointer; border: 1px solid transparent; }
.upload-badge:active { transform: scale(0.95); }
.upload-badge.selected { background: var(--primary-glow); color: var(--primary); border-color: rgba(255, 46, 85, 0.2); }

.queue-item-card { background: var(--bg-color); border: 1px solid rgba(0,0,0,0.05); border-radius: 16px; padding: 12px; display: flex; gap: 12px; margin-bottom: 12px; align-items: center; position: relative; }
.queue-thumb { width: 80px; aspect-ratio: 16/9; border-radius: 8px; object-fit: cover; background: #E2E8F0; }
.queue-details { flex-grow: 1; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.queue-title { font-size: 0.88rem; font-weight: 800; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.queue-progress-container { width: 100%; height: 6px; background: #E2E8F0; border-radius: 10px; overflow: hidden; position: relative; margin-top: 4px; }
.queue-progress-fill { height: 100%; background: var(--primary); width: 0%; transition: width 0.3s ease; }
.queue-status-txt { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); display: flex; justify-content: space-between; }
.queue-actions-row { display: flex; gap: 6px; }
.queue-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--surface); border: 1px solid rgba(0,0,0,0.05); display: flex; align-items: center; justify-content: center; color: var(--text-main); font-size: 0.8rem; cursor: pointer; transition: 0.2s; }
.queue-btn:active { transform: scale(0.85); background: var(--primary); color: white; }

.inner-tab-container { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--glass-border); padding-bottom: 8px; }
.inner-tab-item { padding: 6px 14px; font-size: 0.85rem; font-weight: 800; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; transition: 0.3s; }
.inner-tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Full Screen Pages Stack */
.fullscreen-page {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100vh;
    background: var(--bg-color); z-index: 1500;
    display: none; flex-direction: column; overflow-y: auto;
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }

.appbar {
    height: 64px; background: var(--surface); display: flex; align-items: center;
    padding: 0 16px; border-bottom: 1px solid var(--glass-border); position: sticky; top: 0; z-index: 100;
}
.appbar-back-btn {
    background: none; border: none; font-size: 1.25rem; color: var(--text-main);
    cursor: pointer; width: 40px; height: 40px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; transition: 0.2s;
}
.appbar-back-btn:active { background: var(--border-color); }
.appbar-title { font-size: 1.15rem; font-weight: 800; margin: 0 0 0 12px; color: var(--text-main); }

/* Create Forms */
.avatar-selector-wrap { display: flex; flex-direction: column; align-items: center; margin: 24px 0; }
.avatar-preview-container { width: 110px; height: 110px; border-radius: 50%; background: var(--surface); border: 3px solid var(--primary); cursor: pointer; overflow: hidden; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 20px var(--primary-glow); position: relative; }
.avatar-preview-container img { width: 100%; height: 100%; object-fit: cover; }
.avatar-placeholder { font-size: 2rem; color: var(--text-muted); }
.selector-help { font-size: 0.8rem; color: var(--text-muted); margin: 8px 0 0; font-weight: 600; }

.form-group { margin: 0 20px 20px; position: relative; }
.form-label { display: block; font-size: 0.85rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
.form-input { width: 100%; background: var(--surface); border: 1.5px solid var(--glass-border); padding: 16px; border-radius: 16px; font-size: 1rem; font-weight: 600; color: var(--text-main); outline: none; transition: 0.2s; }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }
.form-textarea { width: 100%; background: var(--surface); border: 1.5px solid var(--glass-border); padding: 16px; border-radius: 16px; font-size: 1rem; font-weight: 600; color: var(--text-main); outline: none; transition: 0.2s; resize: none; height: 120px; }
.form-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }
.form-select { width: 100%; background: var(--surface); border: 1.5px solid var(--glass-border); padding: 16px; border-radius: 16px; font-size: 1rem; font-weight: 600; color: var(--text-main); outline: none; transition: 0.2s; }
.form-select:focus { border-color: var(--primary); }

.handle-input-wrap { position: relative; display: flex; align-items: center; }
.handle-prefix { position: absolute; left: 16px; font-size: 1rem; font-weight: 800; color: var(--text-muted); }
.handle-input-wrap .form-input { padding-left: 36px; }

.handle-feedback-txt { font-size: 0.88rem; margin-top: 8px; font-weight: 700; }
.input-counter { text-align: right; font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; font-weight: 600; }

.btn-primary-action { background: var(--primary); color: white; border: none; border-radius: 18px; padding: 18px; font-size: 1.05rem; font-weight: 800; cursor: pointer; box-shadow: 0 8px 24px var(--primary-glow); transition: 0.2s; margin: 10px 20px 40px; display: block; width: calc(100% - 40px); }
.btn-primary-action:disabled { background: #CBD5E1; color: #94A3B8; box-shadow: none; cursor: not-allowed; }
.btn-primary-action:active:not(:disabled) { transform: scale(0.97); }

/* Material Design 3 Modals and Sheets */
.upcoming-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(15px); z-index: 999999; display: none; justify-content: center; align-items: center; }
.upcoming-content {
    background: var(--surface) !important;
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    border-radius: 28px !important;
    padding: 32px 24px !important;
    width: 90%;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.12) !important;
    animation: md3ScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes md3ScaleIn {
    from { transform: scale(0.9) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.upcoming-icon { width: 70px; height: 70px; background: rgba(255, 46, 85, 0.08); border-radius: 50%; color: var(--primary); font-size: 2rem; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; animation: rotateGlow 3s infinite alternate; }
.upcoming-content h2 { font-size: 1.4rem; font-weight: 800; margin: 0 0 10px; color: var(--text-main); }
.upcoming-content p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; margin: 0 0 25px; }
.upcoming-close-btn { background: var(--primary); color: white; border: none; padding: 12px 30px; border-radius: 14px; font-weight: 800; font-size: 0.95rem; cursor: pointer; transition: 0.2s; box-shadow: 0 5px 15px rgba(255, 46, 85, 0.15); }
.upcoming-close-btn:active { transform: scale(0.95); }

@keyframes rotateGlow { 0% { transform: rotate(0deg) scale(1); box-shadow: 0 0 0 rgba(255, 46, 85, 0); } 100% { transform: rotate(15deg) scale(1.1); box-shadow: 0 0 15px rgba(255, 46, 85, 0.15); } }
