/* ===================================
   RESET & BASE STYLES - TV OPTIMIZED
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background-color: #000000;
    color: #ffffff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Android WebView & TV optimizations */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    /* Hardware acceleration for Android WebView */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* ===================================
   SCREEN MANAGEMENT
   =================================== */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.screen.hidden {
    display: none;
    opacity: 0;
}

/* ===================================
   PAIRING SCREEN - SPLIT LAYOUT TV OPTIMIZED (1080p/4K)
   =================================== */
#pairing-screen {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.pairing-split-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Left Side: Logo & Company Name */
.pairing-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f2557 0%, #1e3c72 100%);
    border-right: 4px solid rgba(255, 255, 255, 0.1);
}

.pairing-logo-section {
    text-align: center;
    padding: 60px;
}

.pairing-logo {
    font-size: clamp(120px, 12vw, 240px);
    margin-bottom: clamp(30px, 3vh, 60px);
    animation: pulse 2s ease-in-out infinite;
}

.pairing-company-name {
    font-size: clamp(64px, 6vw, 128px);
    font-weight: 900;
    margin-bottom: clamp(20px, 2vh, 40px);
    letter-spacing: clamp(2px, 0.3vw, 6px);
    background: linear-gradient(135deg, #ffffff 0%, #a8c0ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pairing-tagline {
    font-size: clamp(24px, 2vw, 48px);
    font-weight: 300;
    opacity: 0.9;
    font-style: italic;
}

/* Right Side: Pairing Code */
.pairing-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.pairing-container {
    text-align: center;
    width: 90%;
    max-width: 700px;
    padding: 40px;
}

.pairing-title {
    font-size: clamp(24px, 2.2vw, 42px);
    font-weight: 700;
    margin-bottom: clamp(20px, 2.5vh, 40px);
    letter-spacing: -1px;
}

.pairing-instructions {
    margin-bottom: clamp(20px, 2.5vh, 35px);
}

.pairing-instructions p {
    font-size: clamp(18px, 1.6vw, 30px);
    font-weight: 300;
    margin: 10px 0;
}

.pairing-website {
    font-size: clamp(22px, 2.2vw, 40px) !important;
    font-weight: 600 !important;
    color: #ffd700;
}

.pairing-code-display {
    background-color: rgba(255, 255, 255, 0.1);
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: clamp(20px, 2.5vh, 35px) clamp(30px, 3.5vw, 50px);
    margin: clamp(20px, 2.5vh, 35px) auto;
    display: inline-block;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.pairing-code {
    font-size: clamp(48px, 5vw, 85px);
    font-weight: 700;
    letter-spacing: clamp(8px, 0.8vw, 14px);
    font-family: 'Courier New', monospace;
    color: #ffffff;
    display: inline-block;
}

.pairing-status {
    margin-top: clamp(25px, 3vh, 45px);
}

.pairing-status p {
    font-size: clamp(16px, 1.5vw, 28px);
    font-weight: 300;
    margin-top: 20px;
    opacity: 0.8;
}

/* ===================================
   CONTENT SCREEN
   =================================== */
#content-screen {
    background-color: #000000;
}

.media-element {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000000;
}

.media-element.hidden {
    display: none;
}

/* ===================================
   BIRTHDAY OVERLAY - TV OPTIMIZED (1080p/4K)
   =================================== */
.birthday-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.5s ease;
    padding: 40px;
}

.birthday-overlay.hidden {
    display: none;
}

.birthday-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: clamp(20px, 2vw, 40px);
    padding: clamp(50px, 5vh, 100px) clamp(60px, 6vw, 100px);
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 1400px;
    width: 90%;
    animation: scaleIn 0.5s ease;
}

.birthday-header {
    font-size: clamp(56px, 5vw, 110px);
    font-weight: 700;
    margin-bottom: clamp(30px, 4vh, 60px);
    text-shadow: 3px 3px 8px rgba(0, 0, 0, 0.3);
}

.birthday-photo {
    width: clamp(220px, 20vw, 420px);
    height: clamp(220px, 20vw, 420px);
    border-radius: 50%;
    object-fit: cover;
    border: clamp(6px, 0.8vw, 12px) solid rgba(255, 255, 255, 0.3);
    margin-bottom: clamp(25px, 3vh, 50px);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

.birthday-name {
    font-size: clamp(44px, 4vw, 80px);
    font-weight: 600;
    margin-top: 30px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
}

/* ===================================
   SCROLLING TEXT (NEWS TICKER MARQUEE) - TV OPTIMIZED (1080p/4K)
   =================================== */
.scrolling-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: clamp(60px, 7vh, 100px);
    background-color: #000000;
    overflow: hidden;
    z-index: 50;
    border-top: 3px solid rgba(255, 255, 255, 0.1);
}

.scrolling-container.hidden {
    display: none;
}

.scrolling-text {
    display: inline-block;
    white-space: nowrap;
    font-size: clamp(28px, 2.5vw, 56px);
    font-weight: 500;
    line-height: clamp(60px, 7vh, 100px);
    padding: 0 clamp(40px, 4vw, 80px);
    animation: marquee linear infinite;
    will-change: transform;
}

/* Continuous marquee animation - starts from right, scrolls to left */
@keyframes marquee {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(-100%);
    }
}

/* Seamless endless loop marquee */
@keyframes marquee-loop {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-33.333%);
    }
}

/* ===================================
   ERROR SCREEN - TV OPTIMIZED (1080p/4K)
   =================================== */
#error-screen {
    background: linear-gradient(135deg, #ff6b6b 0%, #c92a2a 100%);
}

.error-container {
    text-align: center;
    max-width: 1200px;
    width: 90%;
    padding: 60px;
}

.error-container h1 {
    font-size: clamp(48px, 5vw, 96px);
    font-weight: 700;
    margin-bottom: clamp(25px, 3vh, 50px);
}

.error-container p {
    font-size: clamp(18px, 3.5vw, 36px);
    font-weight: 300;
    margin-bottom: clamp(20px, 4vh, 40px);
}

/* ===================================
   LOADING INDICATOR
   =================================== */
.loading-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
}

.loading-indicator.hidden {
    display: none;
}

/* ===================================
   SPINNERS - TV OPTIMIZED (1080p/4K)
   =================================== */
.spinner,
.spinner-small {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner {
    width: clamp(50px, 4vw, 80px);
    height: clamp(50px, 4vw, 80px);
    margin: 0 auto;
}

.spinner-small {
    width: clamp(25px, 2vw, 40px);
    height: clamp(25px, 2vw, 40px);
    border-width: 3px;
}

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

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

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

/* ===================================
   TV-SPECIFIC OPTIMIZATIONS
   =================================== */

/* Prevent image dragging */
img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

/* Hardware acceleration */
.media-element,
.birthday-overlay,
.scrolling-container {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

/* Disable webkit callout */
body {
    -webkit-touch-callout: none;
}

/* Force GPU rendering for smooth playback */
video {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

/* ===================================
   RESPONSIVE ADJUSTMENTS
   =================================== */
@media (max-width: 1280px) {
    .pairing-title {
        font-size: 56px;
    }
    
    .pairing-code {
        font-size: 96px;
    }
    
    .birthday-header {
        font-size: 48px;
    }
    
    .scrolling-text {
        font-size: 36px;
    }
}

@media (max-height: 720px) {
    .pairing-code-display {
        padding: 30px 40px;
    }
    
    .birthday-photo {
        width: 200px;
        height: 200px;
    }
    
    .scrolling-container {
        height: 60px;
    }
    
    .scrolling-text {
        font-size: 32px;
        line-height: 60px;
    }
}
