/* ==========================================================================
   TV Mode Styles - 10-Foot UI for Google TV WebView
   ========================================================================== */

/* TV Mode Variables */
:root {
    --tv-scale: 1.5;
    --tv-overscan-margin: 48px; /* 5% of 1920px / 2 */
    --tv-focus-color: var(--highlight, #00adb5);
    --tv-focus-width: 4px;
    --tv-focus-glow: 0 0 20px var(--tv-focus-color);
}

/* TV Mode Detection via CSS - Targets large screens without touch */
@media (min-width: 1280px) and (hover: hover) and (pointer: fine) {
    /* This is likely a TV or desktop with mouse */
}

/* TV Mode Class - Applied via JavaScript platform detection */
body.tv-mode {
    /* Overscan safe area - 5% margin from edges */
    padding: var(--tv-overscan-margin);
    
    /* Larger base font for 10-foot viewing */
    font-size: calc(16px * var(--tv-scale));
    
    /* Prevent text selection with remote */
    -webkit-user-select: none;
    user-select: none;
    
    /* Smooth scrolling for D-pad */
    scroll-behavior: smooth;
}

/* Hide scrollbar in TV mode */
body.tv-mode::-webkit-scrollbar {
    display: none;
}

body.tv-mode {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ==========================================================================
   Focus States for D-Pad Navigation
   ========================================================================== */

body.tv-mode *:focus {
    outline: var(--tv-focus-width) solid var(--tv-focus-color) !important;
    outline-offset: 4px;
    box-shadow: var(--tv-focus-glow);
    transition: all 0.15s ease-out;
}

body.tv-mode *:focus:not(:focus-visible) {
    outline: none !important;
    box-shadow: none;
}

body.tv-mode *:focus-visible {
    outline: var(--tv-focus-width) solid var(--tv-focus-color) !important;
    outline-offset: 4px;
    box-shadow: var(--tv-focus-glow);
}

/* Focused elements scale up slightly */
body.tv-mode .btn:focus,
body.tv-mode .card:focus,
body.tv-mode .nav-link:focus,
body.tv-mode a:focus {
    transform: scale(1.05);
    z-index: 10;
}

/* ==========================================================================
   Disable Hover Effects (No mouse on TV)
   ========================================================================== */

body.tv-mode .btn:hover,
body.tv-mode .card:hover,
body.tv-mode .nav-link:hover,
body.tv-mode a:hover {
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   Enlarged UI Elements for TV
   ========================================================================== */

body.tv-mode .btn {
    min-height: 64px;
    min-width: 120px;
    font-size: 1.25rem;
    padding: 1rem 2rem;
    border-radius: 12px;
}

body.tv-mode .btn-lg {
    min-height: 80px;
    font-size: 1.5rem;
    padding: 1.25rem 2.5rem;
}

body.tv-mode .btn-sm {
    min-height: 48px;
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
}

body.tv-mode .form-control,
body.tv-mode .form-select {
    min-height: 56px;
    font-size: 1.25rem;
    padding: 1rem 1.25rem;
}

body.tv-mode .nav-link {
    font-size: 1.25rem;
    padding: 1rem 1.5rem;
}

body.tv-mode .card {
    border-radius: 20px;
}

body.tv-mode .card-body {
    padding: 2rem;
}

body.tv-mode .card-title {
    font-size: 1.75rem;
}

/* ==========================================================================
   Typography Scaling for TV
   ========================================================================== */

body.tv-mode h1 { font-size: 4rem; }
body.tv-mode h2 { font-size: 3rem; }
body.tv-mode h3 { font-size: 2.5rem; }
body.tv-mode h4 { font-size: 2rem; }
body.tv-mode h5 { font-size: 1.75rem; }
body.tv-mode h6 { font-size: 1.5rem; }

body.tv-mode p,
body.tv-mode .lead {
    font-size: 1.25rem;
    line-height: 1.8;
}

/* ==========================================================================
   Prayer Card Specific Styles for TV
   ========================================================================== */

body.tv-mode .prayer-card {
    min-height: 250px;
    padding: 2rem;
}

body.tv-mode .prayer-card .prayer-icon {
    font-size: 6rem;
}

body.tv-mode .prayer-card .prayer-name {
    font-size: 2.5rem;
}

body.tv-mode .prayer-card .prayer-time {
    font-size: 2rem;
}

body.tv-mode .prayer-card .btn-task {
    min-height: 80px;
    min-width: 150px;
    font-size: 1.5rem;
}

body.tv-mode .prayer-card .status-badge {
    font-size: 1.5rem;
    padding: 1rem 2rem;
}

/* ==========================================================================
   Navigation Indicators
   ========================================================================== */

body.tv-mode .tv-nav-hint {
    position: fixed;
    bottom: var(--tv-overscan-margin);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    z-index: 9999;
    display: flex;
    gap: 2rem;
    align-items: center;
}

body.tv-mode .tv-nav-hint .hint-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

body.tv-mode .tv-nav-hint .hint-key {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-family: monospace;
}

/* ==========================================================================
   Grid Adjustments for TV
   ========================================================================== */

body.tv-mode .prayer-grid {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

body.tv-mode .row {
    margin-left: -1rem;
    margin-right: -1rem;
}

body.tv-mode .col,
body.tv-mode [class*="col-"] {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* ==========================================================================
   Table Styles for TV
   ========================================================================== */

body.tv-mode .table {
    font-size: 1.25rem;
}

body.tv-mode .table th,
body.tv-mode .table td {
    padding: 1.25rem;
}

body.tv-mode .table .btn {
    min-height: 48px;
    min-width: 100px;
}

/* ==========================================================================
   Modal Adjustments for TV
   ========================================================================== */

body.tv-mode .modal-dialog {
    max-width: 800px;
}

body.tv-mode .modal-content {
    border-radius: 24px;
}

body.tv-mode .modal-header,
body.tv-mode .modal-footer {
    padding: 1.5rem 2rem;
}

body.tv-mode .modal-body {
    padding: 2rem;
    font-size: 1.25rem;
}

body.tv-mode .modal-title {
    font-size: 2rem;
}

/* ==========================================================================
   Hide Elements on TV
   ========================================================================== */

body.tv-mode .hide-on-tv,
body.tv-mode .mobile-only {
    display: none !important;
}

/* ==========================================================================
   Full Screen TV Mode (No Chrome)
   ========================================================================== */

body.tv-mode.tv-fullscreen {
    padding: 0;
}

body.tv-mode.tv-fullscreen .navbar,
body.tv-mode.tv-fullscreen .footer {
    display: none;
}

body.tv-mode.tv-fullscreen .container {
    max-width: 100%;
    padding: var(--tv-overscan-margin);
}

/* ==========================================================================
   High Contrast Mode for TV
   ========================================================================== */

body.tv-mode.tv-high-contrast {
    --tv-focus-color: #ffff00;
    --tv-focus-width: 6px;
}

body.tv-mode.tv-high-contrast *:focus {
    outline-color: #ffff00 !important;
}

/* ==========================================================================
   Animations for TV (Reduced Motion Support)
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    body.tv-mode * {
        transition: none !important;
        animation: none !important;
    }
}

/* ==========================================================================
   4K TV Support (3840px+)
   ========================================================================== */

@media (min-width: 3840px) {
    :root {
        --tv-scale: 2;
        --tv-overscan-margin: 96px;
    }
    
    body.tv-mode {
        font-size: calc(16px * 2);
    }
    
    body.tv-mode .prayer-card .prayer-icon {
        font-size: 8rem;
    }
}
