/* --- Global Reset & Typography --- */
:root {
    --primary-green: #00e676;     /* Bright Neon Green */
    --dark-green: #00a854;        /* Darker Green for hovers */
    --bg-color: #0a0a0a;          /* Deep Black/Grey */
    --card-bg: #161616;           /* Slightly lighter for containers */
    --text-main: #ffffff;
    --text-muted: #b0b0b0;
    --border-radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px;
}

/* --- Main Container --- */
#main-container {
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* --- Header Section --- */
header {
    text-align: center;
    width: 100%;
    margin-bottom: 10px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, #fff, var(--primary-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(0, 230, 118, 0.3);
}

#information {
    color: var(--primary-green);
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.info-row {
    display: inline-flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
    background: var(--card-bg);
    padding: 8px 20px;
    border-radius: 50px;
    border: 1px solid #333;
}

.info-row p {
    margin: 0;
}

#hostCode, #noOfPeople {
    color: white;
    font-weight: bold;
}

/* --- Video Row (iframe + recent sidebar) --- */
#video-row {
    width: 100%;
    max-width: 1320px;
    display: flex;
    flex-direction: row;
    gap: 24px;
    align-items: stretch;
    justify-content: center;
}

#video-row iframe {
    flex: 0 1 1000px;
    width: 1000px;
    max-width: 1000px;
    height: auto;
    aspect-ratio: 16 / 9;
    border: none;
    border-radius: 12px;
    background: #000;
    box-shadow: 0 0 40px rgba(0, 230, 118, 0.15),
                0 10px 20px rgba(0, 0, 0, 0.5);
    transition: box-shadow 0.3s ease;
    order: 1; /* video on the left */
}

#video-row iframe:hover {
    box-shadow: 0 0 60px rgba(0, 230, 118, 0.25),
                0 15px 30px rgba(0, 0, 0, 0.6);
}

/* --- Recently Watched Box (RIGHT side) --- */
#recent-box {
    flex: 0 0 280px;
    order: 2; /* sidebar on the right */
    align-self: stretch;
    background: linear-gradient(180deg, var(--card-bg) 0%, #0d0d0d 100%);
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 0 40px rgba(0, 230, 118, 0.12),
                0 10px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

#recent-box::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-green), transparent);
}

#recent-box h2 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary-green);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #2a2a2a;
    text-shadow: 0 0 10px rgba(0, 230, 118, 0.4);
    text-align: center;
}

#recent-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
}

/* Custom green scrollbar */
#recent-list::-webkit-scrollbar {
    width: 6px;
}
#recent-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}
#recent-list::-webkit-scrollbar-thumb {
    background: var(--dark-green);
    border-radius: 3px;
}
#recent-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-green);
}

#recent-list li {
    background: linear-gradient(135deg, rgba(0, 230, 118, 0.05) 0%, rgba(0, 230, 118, 0.02) 100%);
    border: 1px solid rgba(0, 230, 118, 0.15);
    border-left: 3px solid var(--primary-green);
    border-radius: var(--border-radius);
    padding: 12px 14px;
    font-size: 0.9rem;
    color: var(--text-main);
    transition: all 0.25s ease;
    cursor: default;
    word-break: break-word;
    font-weight: 500;
}

#recent-list li:hover {
    background: linear-gradient(135deg, rgba(0, 230, 118, 0.12) 0%, rgba(0, 230, 118, 0.05) 100%);
    border-color: rgba(0, 230, 118, 0.4);
    border-left-color: var(--primary-green);
    transform: translateX(-3px);
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.15),
                0 4px 12px rgba(0, 0, 0, 0.4);
}

#recent-list .recent-type {
    display: block;
    font-size: 0.7rem;
    color: var(--primary-green);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 5px;
    font-weight: 600;
    opacity: 0.85;
}

#recent-list .recent-empty {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    background: none;
    border: 1px dashed #2a2a2a;
    border-left: 1px dashed #2a2a2a;
    padding: 30px 10px;
}

#recent-list .recent-empty:hover {
    transform: none;
    box-shadow: none;
    background: none;
    border-color: #2a2a2a;
}

/* --- Control Panel --- */
#control-panel {
    width: 100%;
    max-width: 900px;
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: 16px;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Input Groups */
.input-group, .control-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

/* Series Inputs (Hidden by default logic) */
#series-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.05);
    padding: 5px 15px;
    border-radius: var(--border-radius);
    transition: opacity 0.3s ease;
}

.hidden {
    display: none !important;
}

/* --- Form Elements --- */
input[type="text"] {
    background-color: #222;
    border: 1px solid #444;
    color: white;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    font-size: 1rem;
    flex-grow: 1;
    min-width: 200px;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.2);
}

#season, #episode {
    width: 60px;
    min-width: auto;
    text-align: center;
}

label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* --- Buttons --- */
button {
    cursor: pointer;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    border: none;
    transition: all 0.2s ease;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* Primary Green Buttons */
#search-btn, #host-btn, .join-btn {
    background-color: var(--primary-green);
    color: #000;
}

#search-btn:hover, #host-btn:hover, .join-btn:hover {
    background-color: var(--dark-green);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 230, 118, 0.3);
}

/* Toggle Button (Movies/Series) */
#EMbutton {
    background-color: transparent;
    border: 1px solid var(--primary-green);
    color: var(--primary-green);
}

#EMbutton:hover {
    background-color: rgba(0, 230, 118, 0.1);
}

/* Pause Button */
#pause {
    background-color: #f1c40f;
    color: #000;
    min-width: 150px;
}

#pause:hover {
    background-color: #d4ac0d;
}

/* Leave Button */
.leave-btn {
    background-color: #e74c3c;
    color: white;
}

.leave-btn:hover {
    background-color: #c0392b;
}

/* --- Action Buttons Row --- */
.action-buttons {
    padding: 15px 0;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
    width: 100%;
}

/* --- Ad Note --- */
.ad-note {
    font-size: 0.8rem;
    color: #555;
    text-align: center;
    margin-top: 10px;
    font-style: italic;
}

/* --- Responsive Adjustments --- */
@media (max-width: 1100px) {
    #video-row {
        flex-direction: column;
        align-items: center;
    }

    #video-row iframe {
        width: 100%;
        max-width: 1000px;
    }

    #recent-box {
        flex: 0 0 auto;
        width: 100%;
        max-width: 1000px;
        max-height: 280px;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    #control-panel {
        padding: 15px;
    }

    .input-group, .control-row {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }

    button, input[type="text"] {
        width: 100%;
    }

    #series-inputs {
        flex-direction: row;
        justify-content: space-between;
    }
}