/* ========================================================
   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; }

/* =============================================================
   SHORTS TAB CONFIGURATIONS ( TikTok Premium Player Layout )
   ============================================================= */
#shorts-tab {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: calc(100vh - 48px); /* Standard aligned with updated slim Bottom Nav */
    background: #000000 !important;
    color: #FFFFFF !important;
    z-index: 500;
    overflow: hidden;
}
.shorts-swiper {
    height: 100%; width: 100%; overflow-y: scroll;
    scroll-snap-type: y mandatory; scrollbar-width: none;
}
.shorts-swiper::-webkit-scrollbar { display: none; }

.short-slide {
    height: 100%; width: 100%; scroll-snap-align: start;
    scroll-snap-stop: always; position: relative; background: #000000 !important;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}

.short-video-el { 
    max-width: 100%; 
    max-height: 100%; 
    object-fit: contain; 
    background: #000000; 
    margin: auto;
}

/* Shorts Action Button Overlays */
.short-right-actions {
    position: absolute; right: 12px; bottom: 54px !important; /* Sitting perfectly above thin bottom-nav */
    display: flex; flex-direction: column; gap: 16px; z-index: 10; align-items: center;
}
.short-action-container { display: flex; flex-direction: column; align-items: center; }

/* TikTok Circle-less Premium Buttons */
.short-action-btn-tiktok {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    width: 48px; height: 48px; display: flex;
    align-items: center; justify-content: center; font-size: 2.2rem !important;
    cursor: pointer; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: none !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.short-action-btn-tiktok:active { transform: scale(0.8) rotate(-15deg); }
.short-action-btn-tiktok i.liked {
    color: #FF2E55 !important;
    animation: tiktokHeartPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.5) forwards;
}
@keyframes tiktokHeartPop {
    0% { transform: scale(0.5); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1.0); }
}

.short-action-btn-tiktok-other {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    width: 48px; height: 48px; display: flex;
    align-items: center; justify-content: center; font-size: 2.0rem !important;
    cursor: pointer; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: none !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.short-action-btn-tiktok-other:active { transform: scale(0.85); }

.short-action-label-tiktok {
    color: #ffffff !important;
    font-size: 0.75rem;
    font-weight: 800;
    margin-top: 2px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* Bottom Information Overlays */
.short-bottom-info {
    position: absolute;
    bottom: 54px !important; /* Sitting perfectly above the thinner bottom-nav */
    left: 12px;
    right: 76px;
    z-index: 10;
    color: #ffffff !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
.short-channel-handle {
    color: #FFFFFF !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8) !important;
}
.short-title-text {
    color: #FFFFFF !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8) !important;
}
.short-subscribe-btn {
    background: var(--primary) !important;
    border: none; color: #fff !important; padding: 6px 14px;
    border-radius: 20px; font-weight: 800; font-size: 0.78rem; cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2); transition: 0.2s;
}
.short-subscribe-btn:active { transform: scale(0.95); }

/* YouTube-like Progress Bar */
.short-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    z-index: 15;
    cursor: pointer;
}
.short-progress-bar {
    width: 0%;
    height: 100%;
    background: #FF2E55;
    transition: width 0.1s linear;
}

/* Double Tap Heart Animation Styles */
.double-tap-heart {
    position: absolute;
    color: #FF2E55;
    font-size: 11rem !important; 
    z-index: 100;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0);
    animation: heartPopAnim 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    text-shadow: 0 6px 25px rgba(0,0,0,0.45);
}
@keyframes heartPopAnim {
    0% { transform: translate(-50%, -50%) scale(0) rotate(-15deg); opacity: 0; }
    15% { transform: translate(-50%, -50%) scale(1.2) rotate(0deg); opacity: 0.9; }
    30% { transform: translate(-50%, -50%) scale(1) rotate(10deg); opacity: 1; }
    80% { transform: translate(-50%, -50%) scale(1) translateY(-30px); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(0.6) translateY(-60px); opacity: 0; }
}

/* Shorts Expandable Description bottom sheet */
.short-expandable-panel {
    background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(20px);
    border-radius: 20px; padding: 16px; margin-top: 10px; display: none;
    border: 1px solid rgba(255,255,255,0.1); max-height: 200px; overflow-y: auto;
    animation: slideUpFast 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUpFast { from { transform: translateY(15px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
