/* UnwindXR - Real-time Emotion Detection Platform */
/* Modern Classic Design System with Rational Calm Aesthetic */

/* Google Fonts Import for Times New Roman Alternative */
@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:wght@400;700&display=swap');

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    width: 100%;
    height: 100%;
}

body {
    width: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari fix */
    overflow-y: auto; /* Allow vertical scrolling */
    overflow-x: hidden; /* Prevent horizontal scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth iOS scrolling */
    scroll-behavior: smooth;
    font-family: 'Times New Roman', 'Libre Baskerville', serif;
    background: linear-gradient(135deg, 
        #E8E6E3 0%, 
        #FDFCFB 25%, 
        #F5F3F0 50%, 
        #E0DDD8 75%, 
        #D8D5D0 100%);
    background-attachment: fixed;
    color: #2E2E2E; /* Charcoal */
    line-height: 1.6;
    letter-spacing: 0.5px;
    touch-action: manipulation;
    
    /* 4K/Retina Display Optimizations */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Allow scrolling on auth pages - Paper-soft smooth scrolling - iOS Safari fix */
.main-content.auth-page {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: 100vh !important;
    height: 100dvh !important; /* Dynamic viewport height for mobile */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    position: relative;
}

/* Override body behavior for auth pages - Smooth paper-soft scrolling - iOS fix */
body:has(.auth-page) {
    overflow-y: auto !important;
    height: 100vh !important;
    height: 100dvh !important;
    margin: 0;
    padding: 0;
}

html:has(.auth-page) {
    overflow-y: auto !important;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 0;
}


/* Typography System */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700; /* Bold */
    letter-spacing: 1px;
    line-height: 1.4;
}

p, span, div, textarea, input {
    font-weight: 400; /* Regular */
    letter-spacing: 0.8px;
    line-height: 1.8;
}

/* Main content */
.main-content {
    width: 100vw;
    height: 100vh;
    padding: 0;
    margin: 0;
    position: relative;
    background: transparent;
}

/* Camera loads immediately - no onboarding screen */

/* Camera Hub */
.camera-hub {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: transparent;
    overflow: hidden;
}

.camera-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: transparent;
    cursor: crosshair;
}

.camera-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #1A1A1A;
}

/* Live Aura Indicator - Liquid Glass Style */
.live-unwindxr-indicator {
    position: absolute;
    top: 40px;
    right: 40px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    filter: url(#subtleGlass);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.unwindxr-orb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle, #BDBDBD, #A1A1A1); /* Neutral */
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px rgba(189, 189, 189, 0.3);
}

/* Emotional Accent Colors */
.unwindxr-orb.happy {
    background: radial-gradient(circle, #FFC37D, #FFB85C);
    box-shadow: 0 0 20px rgba(255, 195, 125, 0.4);
}

.unwindxr-orb.calm {
    background: radial-gradient(circle, #A3B8A1, #8FA68D);
    box-shadow: 0 0 20px rgba(163, 184, 161, 0.4);
}

.unwindxr-orb.sad {
    background: radial-gradient(circle, #8D99AE, #7A8699);
    box-shadow: 0 0 20px rgba(141, 153, 174, 0.4);
}

.unwindxr-orb.neutral {
    background: radial-gradient(circle, #BDBDBD, #A1A1A1);
    box-shadow: 0 0 20px rgba(189, 189, 189, 0.3);
}

/* Real-time Emotion Overlays */
.emotion-overlays {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

/* Face Detection Area - Responsive to actual face size */
.face-detection-area {
    position: absolute;
    border: 2px solid rgba(163, 184, 161, 0.3);
    border-radius: 50%;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 30;
    opacity: 0.6;
}

.face-detection-area.detected {
    border-color: rgba(163, 184, 161, 0.8);
    box-shadow: 0 0 30px rgba(163, 184, 161, 0.3);
    opacity: 1;
}

/* Floating Emotion Particles - Subtle and Minimal */
.emotion-particle {
    position: absolute;
    pointer-events: none;
    z-index: 40;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.3;
    display: none;
}

/* Happy Emotion - Subtle Dots (No Sparkle Stars) */
.emotion-particle.happy {
    width: 6px;
    height: 6px;
    background: rgba(255, 195, 125, 0.4);
    border-radius: 50%;
    animation: none;
    box-shadow: none;
}

/* Calm Emotion - Subtle */
.emotion-particle.calm {
    width: 6px;
    height: 6px;
    background: rgba(163, 184, 161, 0.3);
    border-radius: 50%;
    animation: none;
}

/* Sad Emotion - Subtle */
.emotion-particle.sad {
    width: 6px;
    height: 6px;
    background: rgba(141, 153, 174, 0.3);
    border-radius: 50%;
    animation: none;
}

/* Neutral Emotion - Subtle */
.emotion-particle.neutral {
    width: 4px;
    height: 4px;
    background: rgba(189, 189, 189, 0.2);
    border-radius: 50%;
    animation: none;
}

/* All emotion particles - Minimal and subtle (effectively hidden) */
.emotion-particle.happy.genuine,
.emotion-particle.happy.social,
.emotion-particle.sad.intense,
.emotion-particle.surprised.genuine,
.emotion-particle.inconsistent,
.emotion-particle.angry,
.emotion-particle.disgusted,
.emotion-particle.fearful,
.emotion-particle.surprised {
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: none;
    box-shadow: none;
    border: none;
    transform: none;
    display: none;
}

/* Particle Animations */
@keyframes sparkle {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
        opacity: 0.8; 
    }
    50% { 
        transform: scale(1.3) rotate(180deg); 
        opacity: 1; 
    }
}

@keyframes gentle-wave {
    0%, 100% { 
        transform: translateY(0) scaleX(1); 
        opacity: 0.6; 
    }
    50% { 
        transform: translateY(-8px) scaleX(1.2); 
        opacity: 0.9; 
    }
}

@keyframes teardrop {
    0%, 100% { 
        transform: rotate(45deg) translateY(0); 
        opacity: 0.4; 
    }
    50% { 
        transform: rotate(45deg) translateY(10px); 
        opacity: 0.8; 
    }
}

@keyframes float {
    0%, 100% { 
        transform: translateY(0); 
        opacity: 0.4; 
    }
    50% { 
        transform: translateY(-12px); 
        opacity: 0.7; 
    }
}

/* Enhanced FACS-based Animations */
@keyframes genuine-sparkle {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
        opacity: 1; 
    }
    25% { 
        transform: scale(1.4) rotate(90deg); 
        opacity: 0.8; 
    }
    50% { 
        transform: scale(1.2) rotate(180deg); 
        opacity: 1; 
    }
    75% { 
        transform: scale(1.3) rotate(270deg); 
        opacity: 0.9; 
    }
}

@keyframes social-sparkle {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
        opacity: 0.8; 
    }
    50% { 
        transform: scale(1.2) rotate(180deg); 
        opacity: 0.9; 
    }
}

@keyframes intense-teardrop {
    0%, 100% { 
        transform: rotate(45deg) translateY(0) scale(1); 
        opacity: 0.6; 
    }
    50% { 
        transform: rotate(45deg) translateY(15px) scale(1.1); 
        opacity: 0.9; 
    }
}

@keyframes surprise-burst {
    0% { 
        transform: rotate(45deg) scale(0.5); 
        opacity: 0.5; 
    }
    50% { 
        transform: rotate(45deg) scale(1.5); 
        opacity: 1; 
    }
    100% { 
        transform: rotate(45deg) scale(1); 
        opacity: 0.8; 
    }
}

@keyframes inconsistent-flicker {
    0%, 100% { 
        opacity: 0.7; 
        transform: scale(1); 
    }
    25% { 
        opacity: 0.3; 
        transform: scale(0.9); 
    }
    75% { 
        opacity: 0.9; 
        transform: scale(1.1); 
    }
}

@keyframes anger-pulse {
    0%, 100% { 
        transform: rotate(45deg) scale(1); 
        opacity: 0.8; 
    }
    50% { 
        transform: rotate(45deg) scale(1.3); 
        opacity: 1; 
        box-shadow: 0 0 15px rgba(255, 107, 107, 0.8); 
    }
}

@keyframes disgust-recoil {
    0%, 100% { 
        transform: translateX(0) scale(1); 
        opacity: 0.7; 
    }
    50% { 
        transform: translateX(-5px) scale(0.9); 
        opacity: 0.9; 
    }
}

@keyframes fear-tremble {
    0%, 100% { 
        transform: translateX(0); 
    }
    25% { 
        transform: translateX(-2px); 
    }
    75% { 
        transform: translateX(2px); 
    }
}

@keyframes surprise-pop {
    0%, 100% { 
        transform: scale(1); 
        opacity: 0.8; 
    }
    50% { 
        transform: scale(1.4); 
        opacity: 1; 
    }
}

/* Swipeable Panels - Liquid Glass Style */
.swipe-panel {
    position: fixed;
    background: rgba(253, 252, 251, 0.35);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 3rem;
    overflow-y: auto;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        inset -1px 0 0 rgba(255, 255, 255, 0.3);
    filter: url(#liquidGlass);
}

.swipe-panel.active {
    transform: translateX(0);
}

.left-panel {
    top: 0;
    left: 0;
    width: 85vw;
    height: 100vh;
}

.right-panel {
    top: 0;
    right: 0;
    width: 85vw;
    height: 100vh;
    transform: translateX(100%);
}

.right-panel.active {
    transform: translateX(0);
}

.up-panel {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    height: 85vh;
    transform: translateY(100%);
    border-top: 2px solid #F0F0F0;
    border-left: none;
    border-right: none;
}

.up-panel.active {
    transform: translateY(0);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.panel-header h2 {
    color: #2E2E2E;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.close-panel {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #2E2E2E;
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Times New Roman', serif;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    filter: url(#subtleGlass);
}

.close-panel:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.1);
    box-shadow: 
        0 6px 12px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.panel-content {
    color: #2E2E2E;
    letter-spacing: 0.8px;
    line-height: 1.8;
}

/* Posts in Feed Panel */
.posts-container {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.post {
    background: #F9F9F9;
    border: 1px solid #F0F0F0;
    padding: 2rem;
    transition: all 0.3s ease;
}

.post:hover {
    background: #F5F5F5;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(46, 46, 46, 0.1);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.author-aura {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #BDBDBD;
}

.author-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.author-name {
    font-weight: 700;
    color: #2E2E2E;
    letter-spacing: 0.8px;
}

.author-username {
    font-size: 0.9rem;
    color: #8A8A8A;
    letter-spacing: 0.5px;
}

.post-time {
    font-size: 0.9rem;
    color: #8A8A8A;
    letter-spacing: 0.5px;
}

.post-content {
    color: #2E2E2E;
    letter-spacing: 0.8px;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.post-image {
    width: 100%;
    margin-top: 1.5rem;
}

/* Auth pages */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 3rem;
    background: transparent;
}

.auth-card {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 4rem;
    max-width: 500px;
    width: 100%;
    border-radius: 24px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    filter: url(#liquidGlass);
}

.auth-header {
    text-align: center;
    margin-bottom: 3rem;
}

.auth-header h1 {
    font-size: 3rem;
    color: #2E2E2E;
    margin-bottom: 1rem;
    letter-spacing: 2px;
}

.auth-header p {
    color: #8A8A8A;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.form-group label {
    font-weight: 700;
    color: #2E2E2E;
    font-size: 1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.form-group input {
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 1.1rem;
    font-family: 'Times New Roman', serif;
    letter-spacing: 0.8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    color: #2E2E2E;
}

.form-group input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.35);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn {
    background: rgba(46, 46, 46, 0.3);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    color: #2E2E2E;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 1.5rem 3rem;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Times New Roman', serif;
    text-transform: uppercase;
    border-radius: 50px;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    filter: url(#subtleGlass);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.btn:hover {
    background: rgba(46, 46, 46, 0.4);
    transform: translateY(-2px);
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.btn.full-width {
    width: 100%;
}

.auth-footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #F0F0F0;
}

.auth-footer a {
    color: #2E2E2E;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.8px;
    transition: all 0.2s ease;
}

.auth-footer a:hover {
    color: #1A1A1A;
}

/* Utility classes */
.hidden {
    display: none !important;
}

.invisible {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(46, 46, 46, 0.2);
    border-top: 3px solid #2E2E2E;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.error-message {
    background: #FFEBEE;
    color: #C62828;
    padding: 1.5rem;
    margin-top: 1.5rem;
    text-align: center;
    border: 2px solid #FFCDD2;
    letter-spacing: 0.8px;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Reduce form spacing for mobile */
    .form-group {
        margin-bottom: 0.9rem; /* 15px - reduced from 1.5rem for mobile */
    }
    
    .onboarding-message {
        font-size: 1.1rem;
        padding: 0 2rem;
    }
    
    .live-unwindxr-indicator {
        top: 20px;
        right: 20px;
    }
    
    .swipe-panel {
        padding: 2rem;
    }
    
    .left-panel, .right-panel {
        width: 95vw;
    }
    
    .panel-header h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .onboarding-message {
        font-size: 1rem;
    }
    
    .grant-access-btn {
        padding: 1rem 2rem;
        font-size: 1rem;
    }
    
    .unwindxr-orb {
        width: 20px;
        height: 20px;
    }
    
    .auth-card {
        padding: 2.5rem;
    }
    
    .auth-header h1 {
        font-size: 2.5rem;
    }
}

/* Emotion Percentages Display - Liquid Glass Style - Positioned below emotion indicator */
.emotion-percentages {
    position: absolute;
    top: 90px;
    right: 20px;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    padding: 15px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-family: "Times New Roman", serif;
    z-index: 250;
    min-width: 200px;
    opacity: 0;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: fade-in 0.5s ease-in-out 1s forwards;
}

.emotion-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.emotion-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.emotion-name {
    color: #FDFCFB !important;
    font-size: 14px;
    text-transform: capitalize;
    font-weight: 400;
}

.emotion-percent {
    color: #A3B8A1 !important;
    font-weight: bold;
    font-size: 14px;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}


/* Z-INDEX HIERARCHY FIX - Prevent UI overlay conflicts */
.modal { z-index: 2000 !important; } /* Highest priority */
.swipe-panel { z-index: 1500 !important; }
.emotion-overlays { z-index: 200 !important; }
.face-detection-area { z-index: 100 !important; }
.emotion-percentages { z-index: 300 !important; }

/* Hide elements when not needed to prevent conflicts */
.modal.hidden { z-index: -1 !important; }
.swipe-panel:not(.active) { z-index: -1 !important; }


/* Auth page compatibility fix - iOS Safari optimized */
.auth-container {
    position: relative;
    width: 100%;
    min-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 2rem 1rem 3rem 1rem;
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 3rem;
}

/* Force auth pages to scroll properly */
.main-content.auth-page {
    position: relative !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: 100vh !important;
    max-height: none !important;
}

/* Emotion percentage panel - improved visibility and fix overlapping */
.emotion-percentages {
    position: fixed !important;
    top: 20px;
    right: 20px;
    z-index: 300 !important;
    background: rgba(46, 46, 46, 0.9) !important;
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(46, 46, 46, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    pointer-events: none;
    min-width: 180px;
}

/* Ensure only one emotion panel exists */
#emotionOverlays .emotion-percentages:not(:first-child) {
    display: none !important;
}

/* Smooth transitions for all UI elements */
* {
    transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* Button hover improvements */
.btn, .auth-form button {
    transition: all 0.2s ease;
    transform: translateZ(0); /* Force hardware acceleration */
}

.btn:hover, .auth-form button:hover {
    transform: translateY(-1px) translateZ(0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}


/* Smooth momentum scrolling for all devices */
* {
    -webkit-overflow-scrolling: touch;
}

.auth-container, .panel-content {
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain;
}

/* Smooth scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(253, 252, 251, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(46, 46, 46, 0.2);
    border-radius: 4px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(46, 46, 46, 0.4);
}


/* iOS Safari viewport fix */
@supports (-webkit-touch-callout: none) {
    html {
        height: -webkit-fill-available;
    }
    
    body {
        min-height: -webkit-fill-available;
    }
    
    .main-content.auth-page {
        min-height: -webkit-fill-available;
    }
    
    .auth-container {
        min-height: -webkit-fill-available;
        padding-bottom: 6rem; /* Extra space for iOS keyboard */
    }
}

/* Improved auth card for better mobile experience */
.auth-card {
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
}


/* Improved form styling for better UX */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

/* Form inputs inherit glass styling from above, only adjust width */
.form-group input {
    width: 100%;
}

.form-group input::placeholder {
    color: #BDBDBD;
    font-size: 0.95rem;
}

.btn.full-width {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-top: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.auth-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(46, 46, 46, 0.1);
}

.auth-footer p {
    font-size: 0.95rem;
    color: #8A8A8A;
}

.auth-footer a {
    color: #2E2E2E;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-footer a:hover {
    color: #A3B8A1;
}

.error-message {
    background: rgba(220, 53, 69, 0.1);
    color: #C82333;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-top: 1rem;
    font-size: 0.9rem;
    border-left: 3px solid #C82333;
}

.success-message {
    background: rgba(163, 184, 161, 0.15);
    color: #2E2E2E;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-top: 1rem;
    font-size: 0.9rem;
    border-left: 3px solid #A3B8A1;
}


/* Force proper scrolling on iOS Safari - Override all conflicts */
@supports (-webkit-touch-callout: none) {
    .main-content.auth-page {
        height: 100vh !important;
        height: 100dvh !important;
        overflow-y: scroll !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        position: relative !important;
    }
    
    .auth-container {
        min-height: 100% !important;
        height: auto !important;
        padding: 2rem 1rem 4rem 1rem !important;
        align-items: flex-start !important;
    }
    
    .auth-card {
        margin: 0 auto;
        width: 100%;
        max-width: 400px;
    }
}

/* ========================================
   RESPONSIVE DESIGN - Mobile First
   ======================================== */

/* Base Mobile Styles (320px - 480px) */
@media (max-width: 480px) {
    /* Typography - Ensure readability on small screens */
    body {
        font-size: 16px; /* Prevent iOS zoom on input focus */
    }
    
    h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    /* Auth Pages - Optimize for small phones */
    .auth-card {
        padding: 1.5rem;
        max-width: 100%;
        margin: 0;
    }
    
    .auth-header h1 {
        font-size: 2.5rem;
    }
    
    .auth-header p {
        font-size: 0.95rem;
    }
    
    /* Form inputs - Touch friendly */
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 0.875rem;
        min-height: 48px;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }
    
    .form-group small {
        font-size: 0.8rem;
    }
    
    /* Buttons - Minimum 44px touch target */
    .btn {
        min-height: 48px;
        font-size: 1rem;
        padding: 0.875rem 1.25rem;
        font-weight: 600;
    }
    
    .btn-primary,
    .btn-secondary {
        min-height: 48px;
    }
    
    /* Camera interface - Optimize for mobile */
    #cameraContainer {
        width: 100%;
        height: auto;
        aspect-ratio: 4/3;
    }
    
    /* Emotion panels */
    .emotion-percentage-panel {
        font-size: 0.85rem;
        padding: 0.5rem;
    }
    
    .emotion-item {
        padding: 0.4rem 0;
    }
    
    .emotion-name {
        font-size: 0.85rem;
    }
    
    .emotion-percent {
        font-size: 0.9rem;
    }
    
    /* Side panels - Full screen on mobile */
    .swipe-panel {
        width: 100% !important;
    }
    
    .panel-content {
        padding: 1rem;
    }
    
    /* Modals - Full screen on mobile */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 1rem auto;
        padding: 1rem;
    }
    
    .modal-header h3 {
        font-size: 1.25rem;
    }
    
    /* Reduce spacing on mobile */
    .auth-container {
        padding: 1rem 0.75rem 3rem 0.75rem;
    }
}

/* Large Phones & Phablets (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    /* Typography */
    body {
        font-size: 16px;
    }
    
    h1 {
        font-size: 2.25rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    /* Auth pages */
    .auth-card {
        padding: 2rem;
        max-width: 420px;
    }
    
    .auth-header h1 {
        font-size: 2.75rem;
    }
    
    /* Form elements */
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px;
        padding: 1rem;
        min-height: 50px;
    }
    
    .btn {
        min-height: 50px;
        font-size: 1.05rem;
        padding: 1rem 1.5rem;
    }
    
    /* Camera interface */
    #cameraContainer {
        max-width: 600px;
        margin: 0 auto;
    }
    
    /* Emotion panels */
    .emotion-percentage-panel {
        font-size: 0.9rem;
        padding: 0.625rem;
    }
    
    /* Side panels - 80% width */
    .swipe-panel {
        width: 80% !important;
    }
    
    /* Modals */
    .modal-content {
        width: 85%;
        max-width: 500px;
        padding: 1.5rem;
    }
}

/* Tablets (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Typography */
    body {
        font-size: 17px;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    /* Auth pages */
    .auth-card {
        padding: 2.5rem;
        max-width: 480px;
    }
    
    .auth-header h1 {
        font-size: 3rem;
    }
    
    /* Camera interface */
    #cameraContainer {
        max-width: 700px;
        margin: 0 auto;
    }
    
    /* Side panels - 60% width */
    .swipe-panel {
        width: 60% !important;
        max-width: 500px;
    }
    
    /* Modals */
    .modal-content {
        width: 70%;
        max-width: 600px;
    }
}

/* Desktop & Large Screens (1025px+) */
@media (min-width: 1025px) {
    /* Optimal desktop experience */
    .auth-card {
        max-width: 500px;
        padding: 3rem;
    }
    
    .auth-header h1 {
        font-size: 3.5rem;
    }
    
    /* Camera interface */
    #cameraContainer {
        max-width: 1280px;
        margin: 0 auto;
    }
    
    /* Side panels */
    .swipe-panel {
        width: 45% !important;
        max-width: 600px;
    }
    
    /* Modals */
    .modal-content {
        max-width: 700px;
    }
    
    /* Hover effects for desktop */
    .btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(46, 46, 46, 0.15);
    }
    
    input:hover,
    textarea:hover,
    select:hover {
        border-color: #A3B8A1;
    }
}

/* Landscape orientation optimizations */
@media (max-height: 600px) and (orientation: landscape) {
    .auth-container {
        padding: 1rem;
        align-items: flex-start;
    }
    
    .auth-card {
        margin-top: 0.5rem;
    }
    
    .auth-header h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    .auth-header p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .form-group {
        margin-bottom: 0.75rem;
    }
}

/* High DPI / Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper text rendering */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Print styles */
@media print {
    .btn,
    .modal,
    .swipe-panel,
    #cameraContainer {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* Logout Button - Liquid Glass Style - Top Left Position */
.logout-btn {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(46, 46, 46, 0.25);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    color: #2E2E2E;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 1px;
    font-size: 0.9rem;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    filter: url(#subtleGlass);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.logout-btn:hover {
    background: rgba(46, 46, 46, 0.35);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

@media (max-width: 768px) {
    .logout-btn {
        top: 1rem;
        left: 1rem;
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }
}

/* ==========================================
   4K/RETINA DISPLAY OPTIMIZATIONS
   ========================================== */

/* High-DPI/Retina Display Media Query */
@media only screen and (-webkit-min-device-pixel-ratio: 2),
       only screen and (min--moz-device-pixel-ratio: 2),
       only screen and (-o-min-device-pixel-ratio: 2/1),
       only screen and (min-device-pixel-ratio: 2),
       only screen and (min-resolution: 192dpi),
       only screen and (min-resolution: 2dppx) {
    
    body {
        font-size: 17px;
    }
    
    h1 { font-size: 3.5rem; }
    h2 { font-size: 2.25rem; }
    h3 { font-size: 1.85rem; }
    
    .btn {
        font-size: 1.15rem;
        padding: 1.6rem 3.2rem;
    }
    
    .logout-btn {
        font-size: 0.95rem;
    }
}

/* Ultra HD 4K Displays */
@media only screen and (min-width: 3840px) {
    body {
        font-size: 20px;
    }
    
    .auth-card {
        max-width: 700px;
        padding: 5rem;
    }
    
    .swipe-panel {
        max-width: 800px;
    }
}

/* ==========================================
   ENHANCED VIBRANT COLOR PALETTE
   ========================================== */

/* Vibrant emotion colors with better saturation */
.unwindxr-orb.happy {
    background: radial-gradient(circle, #FFD700, #FFA500);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
}

.unwindxr-orb.calm {
    background: radial-gradient(circle, #4ECDC4, #44A08D);
    box-shadow: 0 0 25px rgba(78, 205, 196, 0.5);
}

.unwindxr-orb.sad {
    background: radial-gradient(circle, #6495ED, #4169E1);
    box-shadow: 0 0 25px rgba(100, 149, 237, 0.5);
}

/* ==========================================
   AR FILTER CONTROLS
   ========================================== */

.ar-filter-controls {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    z-index: 500;
}

.filter-btn {
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 25px;
    color: #2E2E2E;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Times New Roman', serif;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.filter-btn.active {
    background: rgba(78, 205, 196, 0.3);
    border-color: rgba(78, 205, 196, 0.5);
    color: #2E2E2E;
    box-shadow: 
        0 4px 12px rgba(78, 205, 196, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Camera Video Filters */
#emotionVideo {
    transition: filter 0.3s ease;
}

#emotionVideo.filter-grayscale {
    filter: grayscale(100%);
}

#emotionVideo.filter-sepia {
    filter: sepia(75%);
}

#emotionVideo.filter-blur {
    filter: blur(3px);
}

#emotionVideo.filter-brightness {
    filter: brightness(1.3);
}

#emotionVideo.filter-contrast {
    filter: contrast(1.4);
}

#emotionVideo.filter-saturate {
    filter: saturate(1.8);
}

#emotionVideo.filter-invert {
    filter: invert(100%);
}

#emotionVideo.filter-vintage {
    filter: sepia(50%) contrast(1.2) brightness(1.1);
}

/* Mobile AR Controls */
@media (max-width: 768px) {
    .ar-filter-controls {
        bottom: 1rem;
        gap: 0.5rem;
        padding: 0.75rem;
        flex-wrap: wrap;
        max-width: 90vw;
    }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
}
