/* ===========================
   BMOON TV - Layout Fixes
   TV Left, Controls Right
   NO SCROLL - Single View
   =========================== */

/* Ensure proper scaling on all screens */
html {
    font-size: 16px;
    overflow: hidden;
}

body {
    overflow: hidden !important;
    min-width: 320px;
    height: 100vh;
    padding: 8px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* TV Container - 2 Column Layout */
.tv-container {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100vh;
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 16px;
    align-items: stretch;
    margin: 0 auto;
}

/* TV Frame takes left column */
.tv-frame {
    grid-column: 1;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 16px);
    display: flex;
    flex-direction: column;
    padding: 8px;
    overflow: hidden;
}

/* Controls take right column - COMPACT & REALISTIC */
.controls-wrapper {
    grid-column: 2;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 16px);
    align-self: center;
}

/* Adjust TV screen wrapper padding */
.tv-screen-wrapper {
    padding: 8px;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.tv-screen {
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    position: relative;
    flex-shrink: 0;
}

.tv-screen > * {
    position: absolute;
    inset: 0;
}

/* Make controls fit better */
.channel-nav,
.keypad,
.channel-grid,
.info-bar {
    width: 100%;
    flex-shrink: 0;
}

/* Compact controls - REALISTIC REMOTE SIZE */
.channel-nav {
    padding: 8px 12px;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border: 2px solid #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.keypad {
    padding: 12px;
    gap: 6px;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border: 2px solid #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.keypad-btn {
    min-height: 38px;
    height: 38px;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Adjust TV bezel - COMPACT */
.tv-bezel-top,
.tv-bezel-bottom {
    padding: 6px 12px;
    flex-shrink: 0;
    min-height: 0;
}

.tv-brand {
    font-size: 1rem;
    letter-spacing: 2px;
}

.speaker-grill {
    width: 60px;
    height: 30px;
}

.tv-power-btn {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
}

/* Info bar in TV frame - make compact */
.tv-frame .info-bar {
    padding: 6px;
    margin-top: 6px;
    flex-shrink: 0;
    min-height: 0;
}

/* Responsive - Stack on smaller screens */
@media (max-width: 1200px) {
    body {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 0 !important;
        height: auto !important;
        min-height: 100vh;
    }

    html {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .tv-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 16px;
        max-height: none !important;
        height: auto !important;
        padding: 12px;
        align-items: start;
    }

    .tv-frame {
        grid-column: 1;
        grid-row: 1;
        max-height: none !important;
        height: auto !important;
        margin-bottom: 0;
    }

    .controls-wrapper {
        grid-column: 1;
        grid-row: 2;
        max-height: none !important;
        height: auto !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
        position: relative !important;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0 !important;
        min-height: 100vh;
        height: auto !important;
    }

    .tv-container {
        gap: 12px;
        padding: 8px;
        height: auto !important;
    }

    .tv-frame {
        padding: 6px;
        margin-bottom: 0;
    }

    .tv-screen-wrapper {
        padding: 4px;
    }

    .tv-bezel-top,
    .tv-bezel-bottom {
        padding: 4px 8px;
    }

    .controls-wrapper {
        padding: 6px 6px 10px 6px !important;
        margin-top: 0 !important;
    }
}

/* Fix TV bezel */
.tv-bezel-top,
.tv-bezel-bottom {
    width: 100%;
}

/* Ensure keypad fits in right column */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 16px;
}

.keypad-btn {
    aspect-ratio: 1;
    min-height: 50px;
}

/* Channel grid responsive - COMPACT */
.channel-grid {
    max-height: 180px;
    overflow-y: auto;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border: 2px solid #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

/* Custom scrollbar for channel grid */
.channel-grid::-webkit-scrollbar {
    width: 6px;
}

.channel-grid::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 3px;
}

.channel-grid::-webkit-scrollbar-thumb {
    background: var(--accent-gold);
    border-radius: 3px;
}

.channel-grid::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold-dark);
}

/* Info bar - removed from TV frame, now in remote */

/* Hide loading screen properly */
.loading-screen {
    position: fixed;
    z-index: 9999;
}

/* Compact channel grid items */
.channel-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px;
}

.channel-grid-item {
    aspect-ratio: 16/9;
    border-radius: 4px;
    border: 1.5px solid var(--border-color);
}

.grid-channel-number {
    font-size: 0.65rem;
    padding: 2px 4px;
}

/* Adjust nav buttons - COMPACT */
.nav-btn {
    width: 44px;
    height: 44px;
    border: 2px solid #444;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.channel-display {
    padding: 6px 14px;
    min-width: 80px;
    background: linear-gradient(145deg, #1a1a1a, #0a0a0a);
    border: 2px solid var(--accent-gold);
}

.current-channel {
    font-size: 1.1rem;
}
