/* -------------------------------------------------
   Twitch-style Dark Theme Layout
------------------------------------------------- */

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #0e0e10;
    color: #efeff1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* -------------------------------------------------
   Top Title Bar
------------------------------------------------- */

.header {
    background-color: #18181b;
    padding: 12px 20px;
    font-size: 1.2rem;
    font-weight: bold;
    border-bottom: none; 
    box-shadow: 0 1px 4px rgba(0,0,0,0.6);
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: relative; 
}

/* Oscillating Pink to Purple Gradient Bottom Line */
.header::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px; 
    /* Expanded gradient for smooth sliding */
    background: linear-gradient(270deg, #ff49db, #9146ff, #ff49db);
    background-size: 200% 100%;
    animation: gradientOscillate 4s ease-in-out infinite;
    z-index: 11;
    transition: background 0.5s ease; /* Smooth transition to red */
}

/* The Keyframes that move the background back and forth */
@keyframes gradientOscillate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Offline State (Triggered by JS) */
.header.offline::before {
    background: #ff4c4c; /* Solid Red */
    animation: none; /* Stop the movement */
}
/* -------------------------------------------------
   Info Button
------------------------------------------------- */

.info-btn {
    background: #3a3a3d;
    color: #efeff1;
    border: 1px solid #464649;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}

.info-btn:hover {
    background: #464649;
    border-color: #9146ff;
}

/* -------------------------------------------------
   Main Container
------------------------------------------------- */

.layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    width: 100%;
    height: calc(100vh - 53px);
    height: calc(100dvh - 53px);
    position: relative;
}

/* -------------------------------------------------
   Video Container
------------------------------------------------- */

.video-container {
    flex: 1;
    width: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
}

video {
    width: 100%;
    height: 100%;
    max-height: 100%;
    outline: none;
    background: #000;
    object-fit: contain;
}

/* -------------------------------------------------
   Viewer Count Overlay
------------------------------------------------- */

.viewer-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #efeff1;
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    z-index: 5;
}

.viewer-badge svg {
    width: 14px;
    height: 14px;
    fill: #efeff1;
}

/* -------------------------------------------------
   Chat Log Button
------------------------------------------------- */

.chat-toggle-btn {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    padding: 0;
    background: rgba(30, 20, 45, 0.88);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(145, 70, 255, 0.4);
    border-radius: 50%;
    color: #efeff1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 35;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: background 0.2s, transform 0.2s, opacity 0.2s;
}

.chat-toggle-btn:hover {
    background: rgba(145, 70, 255, 0.95);
    transform: translateY(-50%) scale(1.08);
}

.chat-toggle-btn svg {
    width: 22px;
    height: 22px;
    fill: #efeff1;
}

/* -------------------------------------------------
   Compact Floating Chat Input Box
------------------------------------------------- */

.floating-chat-box {
    position: absolute;
    bottom: 85px;
    right: 20px;
    width: 300px;
    background: rgba(24, 18, 38, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(145, 70, 255, 0.3);
    padding: 8px 12px;
    border-radius: 10px;
    z-index: 15;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* -------------------------------------------------
   Floating Chat Bubbles
------------------------------------------------- */

.bubble-container {
    position: absolute;
    bottom: 150px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    z-index: 12;
    max-width: 300px;
    align-items: flex-end;
}

.chat-bubble {
    background: rgba(24, 18, 38, 0.85);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(145, 70, 255, 0.4);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    animation: bubbleAnim 4s forwards;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    word-wrap: break-word;
    text-align: right;
}

@keyframes bubbleAnim {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    10% {
        opacity: 1;
        transform: translateY(0);
    }
    80% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* -------------------------------------------------
   Chat Sidebar
   Hidden by default
------------------------------------------------- */

.chat-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 340px;
    height: 100%;
    background-color: rgba(24, 18, 38, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(145, 70, 255, 0.2);
    transition: transform 0.3s ease;
    z-index: 30;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
}

.chat-sidebar.collapsed {
    transform: translateX(100%);
}

/* -------------------------------------------------
   Chat Header
------------------------------------------------- */

.chat-header {
    padding: 12px;
    border-bottom: 1px solid rgba(145, 70, 255, 0.2);
    text-align: center;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    color: #d0bfff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-sidebar-btn {
    background: none;
    border: none;
    color: #d0bfff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.close-sidebar-btn:hover {
    color: #ffffff;
}

/* -------------------------------------------------
   Chat Messages Area
------------------------------------------------- */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
}

.chat-message {
    line-height: 1.4;
    word-wrap: break-word;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* -------------------------------------------------
   Chat Text Styling
------------------------------------------------- */

.chat-time {
    font-size: 0.75rem;
    color: #b1a3d0;
    margin-right: 4px;
}

.chat-name {
    font-weight: bold;
    color: #d4bbff;
    margin-right: 5px;
}

.chat-text {
    color: #ffffff;
}

/* -------------------------------------------------
   Forms
------------------------------------------------- */

.prompt-box,
.message-box,
.cookie-consent-box {
    display: flex;
    gap: 6px;
    align-items: center;
    width: 100%;
}

.message-box {
    display: none;
}

.cookie-consent-box {
    display: none;
    font-size: 0.75rem;
    color: #d0bfff;
    justify-content: space-between;
}

input[type="text"] {
    flex: 1;
    padding: 6px 10px;
    border-radius: 6px;
    border: 2px solid #5d35b0;
    background: rgba(20, 14, 32, 0.9);
    color: #fff;
    outline: none;
    font-size: 0.85rem;
    transition: border 0.2s;
    min-width: 0;
}

input[type="text"]:focus {
    border-color: #a970ff;
    background: rgba(10, 6, 16, 0.95);
}

button {
    padding: 6px 10px;
    border-radius: 6px;
    border: none;
    background: #9146ff;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    font-size: 0.85rem;
}

button:hover {
    background: #a970ff;
}

.secondary-btn {
    background: #422b75;
    font-size: 0.75rem;
    padding: 6px 8px;
}

.secondary-btn:hover {
    background: #563996;
}

/* -------------------------------------------------
   Modal Popup Styling
------------------------------------------------- */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.modal-content {
    background: #18181b;
    border: 1px solid #303032;
    padding: 25px;
    border-radius: 10px;
    width: 450px;
    max-width: 90%;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-header {
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    color: #adadb8;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    font-size: 0.95rem;
    color: #adadb8;
    line-height: 1.5;
}

.link-box-container {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.link-input {
    flex: 1;
    font-family: monospace;
    font-size: 0.85rem;
    background: #0e0e10;
}

/* -------------------------------------------------
   Scrollbar Styling
------------------------------------------------- */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(24, 18, 38, 0.3);
}

::-webkit-scrollbar-thumb {
    background: rgba(145, 70, 255, 0.4);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(145, 70, 255, 0.7);
}

/* -------------------------------------------------
   Mobile Responsive Layout
------------------------------------------------- */

@media (max-width: 768px) {
    .chat-sidebar {
        width: 100%;
        height: 50vh;
        top: auto;
        bottom: 0;
        border-left: none;
        border-top: 1px solid rgba(145, 70, 255, 0.2);
    }

    .floating-chat-box {
        bottom: 80px;
        left: 10px;
        right: 10px;
        width: auto;
    }

    .chat-toggle-btn {
        top: auto;
        bottom: 15px;
        right: 15px;
        transform: none;
        width: 44px;
        height: 44px;
        border-radius: 50%;
    }

    .chat-toggle-btn:hover {
        transform: scale(1.08);
    }

    .bubble-container {
        right: 10px;
        bottom: 140px;
    }
}