/* Using CSS Variables for easy theming */
:root {
    --bg-color-dark: #121212;
    --text-color-dark: #e0e0e0;
    --card-color-dark: #1e1e1e;
    --primary-color: #1DB954;
    --border-color: #333;

    --bg-color-light: #f5f5f5;
    --text-color-light: #212121;
    --card-color-light: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 15px;
    transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
    background-color: var(--bg-color-dark);
    color: var(--text-color-dark);
}

body.light-mode {
    background-color: var(--bg-color-light);
    color: var(--text-color-light);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h1 {
    color: var(--primary-color);
    font-size: 2em;
}

.input-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.input-section {
    flex: 1;
    min-width: 300px;
    background-color: var(--card-color-light);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
body.dark-mode .input-section { background-color: var(--card-color-dark); }


.input-group { display: flex; }

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

input[type="text"] {
    flex-grow: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px 0 0 5px;
    background-color: inherit;
    color: inherit;
    font-size: 16px;
}

button {
    padding: 0 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
    border-radius: 0 5px 5px 0;
}
button:hover { background-color: #1ed760; }

.icon-button { border-radius: 50%; width: 40px; height: 40px; padding: 0; }

.main-content {
    display: flex;
    gap: 20px;
}

.video-container { flex: 3; background-color: #000; border-radius: 8px; }
#videoPlayer { width: 100%; height: 100%; border-radius: 8px; }

.channel-list-container {
    flex: 1;
    background-color: var(--card-color-light);
    height: 70vh;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
body.dark-mode .channel-list-container { background-color: var(--card-color-dark); }

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}
#channelCount { font-size: 0.9em; opacity: 0.7; }
#favoritesToggle.active { color: #ffd700; }

#channelList {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

#channelList li {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
}
#channelList li:hover { background-color: rgba(0,0,0,0.1); }
body.dark-mode #channelList li:hover { background-color: #282828; }

#channelList li img { width: 40px; height: 40px; border-radius: 50%; }
.fav-star { margin-left: auto; color: #555; transition: color 0.2s; }
body.light-mode .fav-star { color: #ccc; }
.fav-star.favorited { color: #ffd700; }

/* Loader */
#loader { display: flex; justify-content: center; align-items: center; height: 100%; }
.spinner { border: 4px solid rgba(0, 0, 0, 0.1); width: 36px; height: 36px; border-radius: 50%; border-left-color: var(--primary-color); animation: spin 1s ease infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.hidden { display: none; }

/* --- MOBILE RESPONSIVE --- */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }
    .channel-list-container {
        height: 50vh; /* Adjust height for vertical layout */
    }
}
@media (max-width: 600px) {
    h1 { font-size: 1.5em; }
    .input-container { flex-direction: column; }
    button { padding: 0 15px; }
}