/*
* Styles for the Livestream Page (live.php)
*/

.livestream-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    background-color: #ffffff;
    padding: 1.5rem;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.livestream-container {
    position: relative;
    width: 100%;
    /* 16:9 Aspect Ratio */
    padding-top: 56.25%;
    background-color: #111;
    /* Darker background for cinema feel */
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #ddd;
}

.livestream-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.livestream-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-size: 1.2rem;
    text-align: center;
    padding: 1rem;
}

/* --- UPDATED OFFLINE STATE --- */
.livestream-offline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    text-align: center;
    padding: 2rem;
}

.offline-content {
    max-width: 400px;
    width: 90%;
    /* Ensure it doesn't overflow horizontally on small screens */
}

.livestream-offline i.pulse-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    color: var(--color-secondary, #f6bc3f);
    opacity: 0.8;
}

.livestream-offline h2 {
    font-weight: 800;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fff;
}

.livestream-offline p {
    font-size: 1.2rem;
    font-weight: 500;
    color: #ddd;
    margin-bottom: 0.5rem;
}

.livestream-offline span {
    display: block;
    font-size: 0.95rem;
    font-weight: 400;
    color: #aaa;
    margin-bottom: 2rem;
}

/* Responsive Offline State */
@media (max-width: 768px) {
    .livestream-offline {
        padding: 1rem;
    }

    .livestream-offline i.pulse-icon {
        font-size: 3rem;
        margin-bottom: 1rem;
    }

    .livestream-offline h2 {
        font-size: 1.5rem;
    }

    .livestream-offline p {
        font-size: 1rem;
    }

    .livestream-offline span {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 480px) {
    .livestream-offline i.pulse-icon {
        font-size: 2.5rem;
    }

    .livestream-offline h2 {
        font-size: 1.2rem;
    }
}

/* Offline Action Button */
.offline-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--color-primary, #1a472a);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    border-radius: 50px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.offline-btn:hover {
    background-color: transparent;
    border-color: var(--color-primary, #1a472a);
    color: var(--color-primary, #1a472a);
    /* Assuming background behind is light, but here inside container it might need tweak. */
    background-color: #fff;
    color: #000;
    transform: translateY(-2px);
}

.livestream-info {
    padding: 1rem;
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #eee;
}

.livestream-info-title {
    color: var(--color-primary);
    font-weight: 700;
    font-size: 1.25rem;
    margin: 0 0 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.livestream-info p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--color-text-dark);
    margin: 0;
}

/* Responsive */
@media (min-width: 992px) {
    .livestream-wrapper {
        flex-direction: row;
    }

    .livestream-container {
        flex: 3;
        padding-top: 0;
        /* Override aspect ratio, let height be set by flex partner */
        height: 600px;
        /* Set a fixed height for large screens */
    }

    .livestream-info {
        flex: 1;
    }
}

.livestream-main-col {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Source Selector Styles */
.source-selector {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    background: #f1f1f1;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.source-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: #333;
    margin-right: 5px;
}

.btn-source {
    padding: 8px 16px;
    border: 1px solid #ccc;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-source:hover {
    background-color: #e9e9e9;
    border-color: #bbb;
}

.btn-source.active {
    background-color: var(--color-primary, #004d40);
    color: #fff;
    border-color: var(--color-primary, #004d40);
}

/* Adjust Responsive Layout */
@media (min-width: 992px) {
    .livestream-wrapper {
        flex-direction: row;
        align-items: flex-start;
    }

    .livestream-main-col {
        flex: 3;
    }

    .livestream-container {
        flex: unset;
        width: 100%;
        height: 0;
        padding-top: 56.25%;
        /* Maintain Aspect Ratio */
    }
}

/* Live Viewer Count Badge */
.live-viewer-badge {
    display: inline-flex;
    align-items: center;
    background-color: #dc2626;
    /* Solid Red for high visibility */
    color: #ffffff;
    /* White text */
    padding: 6px 14px;
    border-radius: 50px;
    /* Full pill shape */
    font-size: 0.9rem;
    font-weight: 700;
    margin-left: 15px;
    box-shadow: 0 2px 5px rgba(220, 38, 38, 0.3);
    gap: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    vertical-align: middle;
    transition: all 0.3s ease;
    cursor: pointer;
}

.live-viewer-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.4);
}

.live-indicator-dot {
    width: 10px;
    height: 10px;
    background-color: #ffffff;
    border-radius: 50%;
    display: inline-block;
    animation: pulse-white 2s infinite;
}

@keyframes pulse-white {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(255, 255, 255, 0);
    }
}

/* Viewer Stats Button Removed */

/* Modal Styles */
.viewer-stats-modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
}

.stats-modal-content {
    background-color: #fff;
    width: 90%;
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slide-down 0.3s ease-out;
}

@keyframes slide-down {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.stats-header {
    background-color: var(--color-primary, #004d40);
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.stats-body {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.stats-loading {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 10px;
}

.country-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.country-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.country-list li:last-child {
    border-bottom: none;
}

.country-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.country-flag {
    width: 24px;
    height: auto;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.country-code {
    font-weight: 600;
    color: #333;
}

.viewer-count-badge {
    background-color: #eee;
    color: #333;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.no-stats {
    text-align: center;
    color: #888;
    padding: 10px;
}