/* ==========================================================================
   Syncnema 🍿 - Apple VisionOS / Frost Minimal Liquid Glass Theme
   ========================================================================== */

body {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #060911;
    color: #f8fafc;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar - Frost Glass Minimal */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Ambient Background Lights */
.ambient-glow-1 {
    position: fixed;
    top: -10%;
    left: 15%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    filter: blur(60px);
}
.ambient-glow-2 {
    position: fixed;
    bottom: -15%;
    right: 10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.07) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    filter: blur(80px);
}

/* ==========================================================================
   VisionOS Liquid Glass Core Classes
   ========================================================================== */

/* Floating Island Container - Cinejoy Smoky Charcoal Frosted Glass */
.glass-island {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%), rgba(15, 17, 23, 0.78);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 
        0 20px 50px -10px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.04),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.22);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.glass-island:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.04) 100%), rgba(18, 21, 28, 0.88);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 24px 60px -10px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.32);
}

/* Cinejoy Style Pill Buttons */
.glass-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25), inset 0 1px 0 0 rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #e2e8f0;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}
.glass-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 
        0 6px 18px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.28);
}
.glass-btn:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.09);
}

/* Accent Pill States (Cinejoy Theme Accents) */
.glass-btn-primary {
    background: rgba(6, 182, 212, 0.18);
    border: 1px solid rgba(6, 182, 212, 0.4);
    color: #38bdf8;
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}
.glass-btn-primary:hover {
    background: rgba(6, 182, 212, 0.3);
    border-color: rgba(56, 189, 248, 0.7);
    color: #ffffff;
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.35), inset 0 1px 0 0 rgba(255, 255, 255, 0.3);
}

.glass-btn-amber {
    background: rgba(245, 158, 11, 0.16);
    border: 1px solid rgba(245, 158, 11, 0.38);
    color: #fbbf24;
}
.glass-btn-amber:hover {
    background: rgba(245, 158, 11, 0.28);
    border-color: rgba(245, 158, 11, 0.7);
    color: #ffffff;
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.3);
}

.glass-btn-green {
    background: rgba(34, 197, 94, 0.16);
    border: 1px solid rgba(34, 197, 94, 0.38);
    color: #4ade80;
}
.glass-btn-green:hover {
    background: rgba(34, 197, 94, 0.28);
    border-color: rgba(34, 197, 94, 0.7);
    color: #ffffff;
    box-shadow: 0 0 18px rgba(34, 197, 94, 0.3);
}

/* Cinejoy Glass Inputs */
.glass-input, #partner-id-input {
    min-width: 0 !important;
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    transition: all 0.2s ease !important;
}
.glass-input::placeholder, #partner-id-input::placeholder {
    color: rgba(255, 255, 255, 0.45) !important;
}
.glass-input:focus, #partner-id-input:focus {
    background: rgba(255, 255, 255, 0.14) !important;
    border-color: rgba(56, 189, 248, 0.55) !important;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    outline: none !important;
}

/* Cinejoy Style Glass Modals */
.modal-overlay {
    background-color: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
}
.modal-content {
    background: rgba(15, 17, 23, 0.86);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 
        0 25px 60px -10px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.04),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.18);
    border-radius: 1.5rem;
}

/* Chat Sidebar - Translucent Floating Frosted Glass Window */
#chat-sidebar {
    position: absolute;
    right: 4.75rem;
    top: 4.75rem;
    bottom: 5.5rem;
    width: 330px;
    max-width: calc(100vw - 5.5rem);
    background: rgba(10, 15, 26, 0.32);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 1.5rem;
    box-shadow: 
        0 20px 50px -10px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.22);
    transform: translateX(0);
    opacity: 1;
    z-index: 40;
    overflow: hidden;
    mask-image: linear-gradient(to bottom, transparent 0%, transparent 60%, rgba(0, 0, 0, 0.35) 70%, rgba(0, 0, 0, 0.85) 80%, black 88%, black 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent 60%, rgba(0, 0, 0, 0.35) 70%, rgba(0, 0, 0, 0.85) 80%, black 88%, black 100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, mask-image 0.45s ease, -webkit-mask-image 0.45s ease;
    pointer-events: auto;
}
#chat-sidebar.scrolled-history {
    mask-image: linear-gradient(to bottom, black 0%, black 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 100%);
}
.sidebar-closed {
    transform: translateX(calc(100% + 5rem)) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

@media (max-width: 640px) {
    #chat-sidebar {
        right: 0.5rem;
        left: 0.5rem;
        width: auto;
        max-width: none;
        top: 4.25rem;
        bottom: 5rem;
        border-radius: 1.25rem;
    }
}
:fullscreen #chat-sidebar {
    position: absolute;
    right: 4.75rem;
    top: 4.75rem;
    bottom: 5.5rem;
    z-index: 60;
}

/* Chat Header and Messages inside Translucent Sidebar */
#chat-sidebar > div:first-child {
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
#chat-messages {
    display: flex;
    flex-direction: column;
    mask-image: none;
    -webkit-mask-image: none;
}
#chat-messages > :first-child {
    margin-top: auto !important;
}
#chat-top-fade {
    display: none;
}

/* Toast Notifications */
@keyframes fadeInSlide {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.toast-msg {
    animation: fadeInSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    background: rgba(15, 23, 42, 0.75) !important;
    backdrop-filter: blur(24px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
}

/* Floating Status Badges */
.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}
.st-red {
    background-color: #f87171;
    box-shadow: 0 0 8px #f87171;
}
.st-yellow {
    background-color: #fbbf24;
    box-shadow: 0 0 8px #fbbf24;
    animation: pulse 1s infinite;
}
.st-green {
    background-color: #4ade80;
    box-shadow: 0 0 8px #4ade80;
}
.st-blue {
    background-color: #38bdf8;
    box-shadow: 0 0 10px #38bdf8;
}
@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}

/* Video Subtitles */
video::cue {
    font-family: 'Vazirmatn', sans-serif;
    background-color: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    font-size: 1.15em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    border-radius: 6px;
    padding: 2px 8px;
}

/* Interactive Timestamps in Chat */
.timestamp-chip {
    display: inline-block;
    direction: ltr;
    unicode-bidi: embed;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 9999px;
    padding: 1px 7px;
    margin: 0 2px;
    font-family: monospace;
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}
.timestamp-chip:hover {
    background: rgba(56, 189, 248, 0.35);
    color: #ffffff;
    border-color: rgba(56, 189, 248, 0.6);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
    transform: scale(1.04);
}

/* Floating Reactions Animation */
@keyframes floatUp {
    0% { transform: translateY(0) scale(0.5); opacity: 0; }
    20% { transform: translateY(-25px) scale(1.2); opacity: 1; }
    80% { transform: translateY(-100px) scale(1); opacity: 0.85; }
    100% { transform: translateY(-180px) scale(0.6); opacity: 0; }
}
.reaction-anim {
    position: absolute;
    animation: floatUp 2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    pointer-events: none;
    font-size: 3.2rem;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6));
    z-index: 45;
}

emoji-picker {
    position: absolute;
    bottom: 75px;
    left: 10px;
    z-index: 60;
    --emoji-font-family: 'Vazirmatn';
    height: 320px;
    width: calc(100% - 20px);
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Landscape Mode Prompt */
#landscape-warning { display: none; }
@media only screen and (max-width: 768px) and (orientation: portrait) {
    #landscape-warning { display: flex; }
    #landscape-warning.hidden-force { display: none !important; }
}
@keyframes rotate-phone {
    0%, 10% { transform: rotate(0deg); }
    40%, 60% { transform: rotate(90deg); }
    90%, 100% { transform: rotate(0deg); }
}
.phone-icon {
    font-size: 4rem;
    animation: rotate-phone 3s infinite ease-in-out;
}
