/* ========================================
   AI-COACH DEMO - MOBILE FULLSCREEN
   GUARANTEED TO WORK
   ======================================== */

:root {
    --brand-blue: #1976D2;
    --brand-purple: #7B1FA2;
    --brand-gradient: linear-gradient(135deg, #1976D2 0%, #7B1FA2 100%);
    --dark-1: #0A0E27;
    --dark-2: #151B3D;
    --success: #4CAF50;
    --error: #F44336;
}

/* Force fullscreen */
html, body {
    width: 100%;
    height: 100%;
    overflow: hidden !important;
    position: fixed;
    margin: 0;
    padding: 0;
}

/* ========================================
   HERO SECTION - INITIAL STATE
   ======================================== */
.demo-hero {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark-1);
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: opacity 0.3s ease;
}

.demo-hero.hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

/* Animated background */
.demo-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(25, 118, 210, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(123, 31, 162, 0.15) 0%, transparent 50%);
    animation: heroGlow 20s ease-in-out infinite;
    z-index: 0;
}

@keyframes heroGlow {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
}

.hero-container {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.demo-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    color: #00BCD4;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 24px;
}

.badge-dot {
    width: 8px;
    height: 8px;
    background: #00BCD4;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

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

.demo-hero h1 {
    font-size: clamp(28px, 8vw, 48px);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #00BCD4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: clamp(16px, 3vw, 18px);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 40px;
}

/* Hero Start Button - Below Text */
.hero-start-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 320px;
    padding: 20px 40px;
    background: var(--brand-gradient);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 
        0 12px 40px rgba(25, 118, 210, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    min-height: 64px;
    border: none;
    outline: none;
}

.hero-start-btn:active {
    transform: scale(0.98);
    box-shadow: 
        0 8px 30px rgba(25, 118, 210, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.hero-start-btn .btn-icon {
    font-size: 20px;
}

/* ========================================
   FULL SCREEN DEMO
   ======================================== */
.fullscreen-demo {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 999999;
}

.fullscreen-demo.active {
    display: block;
}

.video-fullscreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#skeleton-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* Loading State */
.loading-state {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--dark-1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-state.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--brand-blue);
    border-right-color: var(--brand-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
    box-shadow: 0 0 30px rgba(25, 118, 210, 0.4);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p {
    color: white;
    font-size: 16px;
    font-weight: 500;
}

/* ========================================
   REP COUNTER - TOP CENTER
   ======================================== */
.rep-counter-overlay {
    position: absolute;
    top: max(20px, env(safe-area-inset-top, 20px));
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 14, 39, 0.9);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 16px 32px;
    border-radius: 20px;
    text-align: center;
    z-index: 5;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.rep-label {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.rep-value {
    display: block;
    color: white;
    font-size: 40px;
    font-weight: 900;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   FEEDBACK - ENHANCED DISPLAY
   ======================================== */
.feedback-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    padding-bottom: calc(74px + max(20px, env(safe-area-inset-bottom, 20px)));
    background: linear-gradient(to top, rgba(10, 14, 39, 0.98) 0%, rgba(10, 14, 39, 0.95) 100%);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 3;
    transition: all 0.4s ease;
    max-height: 50vh;
    overflow-y: auto;
}

.feedback-overlay.success {
    animation: feedbackPulse 0.6s ease;
    border-top-color: var(--success);
    background: linear-gradient(to top, rgba(76, 175, 80, 0.2) 0%, rgba(10, 14, 39, 0.95) 100%);
}

.feedback-overlay.warning {
    border-top-color: #FF9800;
    background: linear-gradient(to top, rgba(255, 152, 0, 0.2) 0%, rgba(10, 14, 39, 0.95) 100%);
}

.feedback-overlay.error {
    border-top-color: var(--error);
    background: linear-gradient(to top, rgba(244, 67, 54, 0.2) 0%, rgba(10, 14, 39, 0.95) 100%);
}

@keyframes feedbackPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.01); }
}

/* Feedback Header */
.feedback-header {
    margin-bottom: 12px;
}

.feedback-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.feedback-icon {
    font-size: 32px;
    filter: drop-shadow(0 4px 12px rgba(25, 118, 210, 0.4));
    flex-shrink: 0;
}

.feedback-title {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.feedback-label {
    font-size: 16px;
    font-weight: 700;
    color: white;
}

.feedback-score {
    font-size: 20px;
    font-weight: 900;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.feedback-score.excellent {
    background: linear-gradient(135deg, #4CAF50 0%, #81C784 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.feedback-score.good {
    background: linear-gradient(135deg, #2196F3 0%, #64B5F6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.feedback-score.needs-work {
    background: linear-gradient(135deg, #FF9800 0%, #FFB74D 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.feedback-score.poor {
    background: linear-gradient(135deg, #F44336 0%, #E57373 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Feedback Message */
.feedback-message {
    font-size: 14px;
    font-weight: 500;
    color: #00BCD4;
    line-height: 1.5;
    margin-bottom: 12px;
}

/* Improvements List */
.feedback-improvements {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.improvements-title {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

#improvements-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#improvements-list li {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    padding-left: 20px;
    position: relative;
    line-height: 1.4;
}

#improvements-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: #FF9800;
    font-weight: bold;
}

/* ========================================
   CONTROL BUTTONS - ALWAYS VISIBLE & CENTERED
   ======================================== */
.control-overlay {
    position: absolute;
    bottom: max(20px, env(safe-area-inset-bottom, 20px));
    left: 50%;
    transform: translateX(-50%);
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    z-index: 5;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    max-width: 90%;
    width: auto;
}

.stop-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    background: linear-gradient(135deg, #F44336 0%, #D32F2F 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 
        0 8px 24px rgba(244, 67, 54, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    min-height: 54px;
    outline: none;
}

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

.stop-btn .btn-icon {
    font-size: 16px;
}

.switch-btn {
    width: 54px;
    height: 54px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    outline: none;
}

.switch-btn:active {
    transform: scale(0.95) rotate(180deg);
}

.feedback-icon {
    font-size: 36px;
    filter: drop-shadow(0 4px 12px rgba(25, 118, 210, 0.4));
    flex-shrink: 0;
}

.feedback-text {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: white;
    line-height: 1.5;
}

/* ========================================
   REFERENCE IMAGE OVERLAY
   ======================================== */
.reference-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(20px);
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.reference-overlay.active {
    display: flex;
}

.reference-overlay img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 20px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}

.close-reference {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.close-reference:active {
    transform: rotate(90deg);
}

/* ========================================
   NOTIFICATION TOAST
   ======================================== */
.notification-toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 18px 28px;
    border-radius: 16px;
    z-index: 1000000;
    transition: bottom 0.4s ease;
    max-width: 90%;
    text-align: center;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    font-weight: 600;
    font-size: 14px;
}

.notification-toast.show {
    bottom: 30px;
}

.notification-toast.success {
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
    box-shadow: 
        0 10px 40px rgba(76, 175, 80, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.notification-toast.error {
    background: linear-gradient(135deg, #F44336 0%, #D32F2F 100%);
    box-shadow: 
        0 10px 40px rgba(244, 67, 54, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.notification-toast.warning {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    box-shadow: 
        0 10px 40px rgba(255, 152, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* ========================================
   RESPONSIVE - DESKTOP
   ======================================== */
@media (min-width: 768px) {
    .rep-value {
        font-size: 48px;
    }
    
    .feedback-overlay {
        bottom: 130px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        max-width: 90%;
        width: auto;
        padding: 20px 30px;
        padding-bottom: 20px;
    }
    
    .control-overlay {
        bottom: 40px;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        min-width: 350px;
        max-width: 600px;
    }
}

/* Mirror video for front camera */
#video.mirrored {
    transform: scaleX(-1);
}

/* Error Display */
.error-display {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90%;
    background: rgba(244, 67, 54, 0.95);
    color: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 10000;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.error-display.show {
    display: block;
}

.error-display-title {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.error-display-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}