/* Yolcu Page - Tesla Passenger Screen TV Player */
/* Touch-optimized design for in-car entertainment */

/* Prevent body scroll on touch devices */
html, body {
    overscroll-behavior: none;
}

/* ===== DISPLAY SECTION ===== */
.yolcu-display-section {
    width: 100%;
    background: #000;
    position: relative;
}

#yolcu-frame-box {
    width: 100%;
    height: 56.25vw; /* 16:9 aspect ratio */
    max-height: 70vh;
    min-height: 300px;
    position: relative;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#cv-render {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

/* Frame overlays */
.frame-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    text-align: center;
    z-index: 10;
    box-sizing: border-box;
}

#init-overlay {
    background: #000;
}

.frame-overlay p {
    margin: 15px 0 0 0;
    font-size: 1.2em;
}

.frame-overlay .initial-logo {
    width: 120px;
    height: auto;
    max-width: 40%;
}

.spinner-border {
    width: 50px;
    height: 50px;
}

/* Channel info overlay */
.channel-info-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 15;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.channel-info-overlay.visible {
    opacity: 1;
}

.channel-info-overlay img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    background: white;
    border-radius: 6px;
    padding: 4px;
    margin-right: 15px;
}

.channel-info-text {
    display: flex;
    flex-direction: column;
}

.channel-info-overlay #ch-name {
    font-size: 1.4em;
    font-weight: 600;
    color: white;
}

.live-badge {
    display: inline-block;
    background: #e50914;
    color: white;
    font-size: 0.7em;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 3px;
    margin-top: 5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ===== CONTROLS ===== */
#ctl-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    padding: 30px 20px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 20;
}

#yolcu-frame-box:hover #ctl-bar,
#yolcu-frame-box.controls-visible #ctl-bar {
    opacity: 1;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls-center {
    flex: 1;
    text-align: center;
}

.current-channel {
    color: white;
    font-size: 1.2em;
    font-weight: 500;
}

/* Touch-optimized buttons - minimum 48px touch target */
.control-btn {
    width: 56px;
    height: 56px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.control-btn:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
}

.volume-slider {
    width: 100px;
    height: 8px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
}

/* Quality selector */
.quality-selector {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 4px;
    margin-right: 10px;
}

.quality-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #aaa;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.quality-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.quality-btn.active {
    background: #007bff;
    color: white;
}

.quality-btn:active {
    transform: scale(0.95);
}

/* ===== SEARCH SECTION ===== */
.yolcu-search-section {
    background: #11243c;
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.search-wrapper {
    position: relative;
    max-width: 100%;
}

.yolcu-search-input {
    width: 100%;
    padding: 18px 60px 18px 20px;
    font-size: 18px;
    border: 2px solid #2d4a6f;
    border-radius: 12px;
    background: #1a3a5c;
    color: white;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}

.yolcu-search-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.yolcu-search-input::placeholder {
    color: #8aa4c0;
}

.search-clear-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.search-clear-btn:active {
    background: rgba(255, 255, 255, 0.4);
}

/* ===== CHANNEL GRID SECTION ===== */
.yolcu-channels-section {
    background: #0d1b2a;
    padding: 20px 0 40px;
    min-height: 300px;
}

.channels-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 15px;
}

.channels-header h2 {
    color: white;
    font-size: 1.5em;
    margin: 0;
}

.channel-count {
    color: #8aa4c0;
    font-size: 0.95em;
}

/* 4-column grid */
.channel-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 0 15px;
}

/* Channel card - touch optimized */
.channel-card {
    background: #152f4f;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.channel-card:active {
    transform: scale(0.98);
    background: #1a4070;
}

.channel-card.active {
    background: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5);
}

.channel-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 15px;
    min-height: 140px;
}

.channel-card .channel-logo {
    width: 70px;
    height: 70px;
    object-fit: contain;
    background: white;
    border-radius: 10px;
    padding: 8px;
    margin-bottom: 12px;
}

.channel-card .channel-name {
    color: white;
    font-size: 0.95em;
    text-align: center;
    font-weight: 500;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* No results */
.no-results {
    text-align: center;
    padding: 60px 20px;
}

.no-results p {
    color: #8aa4c0;
    font-size: 1.2em;
}

/* ===== FULLSCREEN MODE ===== */
#yolcu-frame-box:fullscreen,
#yolcu-frame-box:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    max-height: none;
}

#yolcu-frame-box:fullscreen #cv-render,
#yolcu-frame-box:-webkit-full-screen #cv-render {
    max-width: 100vw;
    max-height: 100vh;
}

#yolcu-frame-box:fullscreen #ctl-bar,
#yolcu-frame-box:-webkit-full-screen #ctl-bar {
    padding: 40px 30px 30px;
}

#yolcu-frame-box:fullscreen .control-btn,
#yolcu-frame-box:-webkit-full-screen .control-btn {
    width: 70px;
    height: 70px;
    font-size: 30px;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet landscape - 3 columns */
@media screen and (max-width: 1200px) {
    .channel-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet portrait - 3 columns */
@media screen and (max-width: 991px) {
    #yolcu-frame-box {
        height: 50vw;
        min-height: 250px;
    }

    .channel-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .channel-card-inner {
        padding: 15px 10px;
        min-height: 120px;
    }

    .channel-card .channel-logo {
        width: 55px;
        height: 55px;
    }

    .channel-card .channel-name {
        font-size: 0.85em;
    }

    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .volume-slider {
        width: 80px;
    }
}

/* Mobile landscape - 4 columns smaller */
@media screen and (max-width: 768px) and (orientation: landscape) {
    #yolcu-frame-box {
        height: 70vh;
    }

    .channel-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .channel-card-inner {
        padding: 10px 8px;
        min-height: 90px;
    }

    .channel-card .channel-logo {
        width: 40px;
        height: 40px;
    }

    .channel-card .channel-name {
        font-size: 0.75em;
    }
}

/* Mobile portrait - 2 columns */
@media screen and (max-width: 600px) {
    #yolcu-frame-box {
        height: 56.25vw;
        min-height: 200px;
    }

    .channel-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .channel-card-inner {
        padding: 15px 10px;
        min-height: 110px;
    }

    .channel-card .channel-logo {
        width: 50px;
        height: 50px;
    }

    .channel-card .channel-name {
        font-size: 0.85em;
    }

    .yolcu-search-input {
        padding: 15px 55px 15px 15px;
        font-size: 16px;
    }

    .channels-header h2 {
        font-size: 1.2em;
    }

    .control-btn {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }

    .volume-slider {
        display: none;
    }

    .current-channel {
        font-size: 1em;
    }

    .channel-info-overlay {
        top: 10px;
        left: 10px;
        padding: 8px 12px;
    }

    .channel-info-overlay img {
        width: 35px;
        height: 35px;
        margin-right: 10px;
    }

    .channel-info-overlay #ch-name {
        font-size: 1.1em;
    }
}

/* Very small screens - 2 columns */
@media screen and (max-width: 400px) {
    .channel-card-inner {
        padding: 12px 8px;
        min-height: 100px;
    }

    .channel-card .channel-logo {
        width: 45px;
        height: 45px;
    }

    .channel-card .channel-name {
        font-size: 0.8em;
    }
}

/* ===== SCROLLBAR STYLING ===== */
.yolcu-channels-section::-webkit-scrollbar {
    width: 8px;
}

.yolcu-channels-section::-webkit-scrollbar-track {
    background: #0d1b2a;
}

.yolcu-channels-section::-webkit-scrollbar-thumb {
    background: #2d4a6f;
    border-radius: 4px;
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .channel-card,
    .control-btn,
    #ctl-bar,
    .channel-info-overlay {
        transition: none;
    }

    .live-badge {
        animation: none;
    }
}

/* Focus states for keyboard navigation */
.channel-card:focus,
.control-btn:focus,
.yolcu-search-input:focus {
    outline: 3px solid #007bff;
    outline-offset: 2px;
}

/* Disable text selection on interactive elements */
.channel-card,
.control-btn,
#ctl-bar {
    user-select: none;
    -webkit-user-select: none;
}

/* ===== ADVERTISEMENT SECTIONS ===== */

.yolcu-ad-section {
    background: #0a1628;
    padding: 15px 0;
}

.ad-below-player {
    border-bottom: 1px solid #1a3a5c;
}

.ad-below-channels {
    border-top: 1px solid #1a3a5c;
    padding: 20px 0;
}

.ad-label {
    color: #5f7a94;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-align: center;
}

/* Native ad card in grid */
.channel-card.ad-card {
    background: linear-gradient(135deg, #1a3a5c 0%, #0d2137 100%);
    border: 1px dashed #2d4a6f;
    cursor: default;
}

.channel-card.ad-card:active {
    transform: none;
    background: linear-gradient(135deg, #1a3a5c 0%, #0d2137 100%);
}

.ad-card-inner {
    padding: 10px;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive ads */
@media screen and (max-width: 768px) {
    .ad-card-inner {
        min-height: 120px;
    }
}

@media screen and (max-width: 600px) {
    .yolcu-ad-section {
        padding: 10px 0;
    }

    .ad-card-inner {
        min-height: 100px;
    }
}
