/* --- MODERN THEME VARIABLES --- */
:root {
    --primary-color: #1abc9c;
    /* Restore Old Green */
    --primary-dark: #16a085;
    /* Darker Green */
    --secondary-color: #2c3e50;
    /* Dark Slate */
    --accent-color: #e67e22;
    /* Compass Orange (or keep as secondary accent) */
    --danger-color: #e74c3c;
    /* Red */
    --background-color: #f0f2f5;
    /* Light Gray Background */
    --card-bg: #ffffff;
    /* White Cards */
    --text-main: #333333;
    --text-muted: #7f8c8d;
    --border-color: #e1e4e8;
    --sidebar-width: 260px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

body,
html {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-main);
    height: 100%;
}

* {
    box-sizing: border-box;
}

/* --- AUTH PAGE --- */
/* --- AUTH PAGE --- */
/* --- AUTH PAGE --- */
/* Wrapper to handle background positioning relative to viewport */
body.auth-mode {
    overflow: hidden;
    background-color: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

/* Split Layout Container */
.split-login-wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.split-left {
    flex: 1;
    background: #f0f2f5;
    /* Light background for Login Form side (Now Left) */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    /* border-right: 1px solid #e1e4e8; Removed separation line */
}

.split-right {
    flex: 1;
    background: #f0f2f5;
    /* Unified Light background */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Large TV Screen */
.tv-screen-large {
    width: 80%;
    /* Reduced width */
    max-width: 600px;
    /* Reduced max-width for better balance */
    aspect-ratio: 16/9;
    background: #000;
    border: 15px solid #333;
    border-radius: 15px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.7);
    position: relative;
    overflow: hidden;
}

/* TV Stand base */
.tv-screen-large::after {
    content: '';
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 25px;
    background: #222;
    border-radius: 0 0 8px 8px;
}

/* Slideshow Animation */
.tv-screen-large .slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    animation: slideShow 12s infinite;
}

/* Placeholder Gradients */
.slide-1 {
    background: linear-gradient(45deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
    animation-delay: 0s;
}

.slide-2 {
    background: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
    animation-delay: 4s;
}

.slide-3 {
    background: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%);
    animation-delay: 8s;
}

@keyframes slideShow {
    0% {
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    33% {
        opacity: 1;
    }

    43% {
        opacity: 0;
    }

    100% {
        opacity: 0;
    }
}

/* Ticker Animation */
.ticker-wrap {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    overflow: hidden;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.6);
    padding-left: 100%;
    box-sizing: content-box;
    z-index: 20;
}

.ticker {
    display: inline-block;
    height: 40px;
    line-height: 40px;
    white-space: nowrap;
    padding-right: 100%;
    box-sizing: content-box;
    animation: ticker 15s linear infinite;
}

.ticker-item {
    display: inline-block;
    padding: 0 2rem;
    font-size: 1.2rem;
    color: white;
    font-family: 'Courier New', Courier, monospace;
}

@keyframes ticker {
    0% {
        transform: translate3d(0, 0, 0);
    }

    100% {
        transform: translate3d(-100%, 0, 0);
    }
}

/* Auth Container Adjustments */
/* Auth Container Adjustments */
#auth-container {
    width: 100%;
    max-width: 450px;
    padding: 60px 40px;
    background: #2c3e50;
    /* Dark Background */
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    text-align: center;
    position: relative;
    z-index: 10;
    margin: 0;
}

.auth-footer-fixed {
    position: fixed;
    bottom: 20px;
    left: 0;
    width: 100%;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9em;
    font-weight: 500;
    z-index: 20;
}

.auth-logo {
    max-width: 250px;
    height: auto;
    margin-bottom: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

#auth-container h2 {
    color: white;
    /* White Text */
    margin-bottom: 30px;
    font-weight: 700;
    font-size: 1.5em;
    letter-spacing: -0.5px;
}

#auth-container input {
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 15px;
    border: 2px solid #34495e;
    /* Dark Border */
    border-radius: var(--radius);
    font-size: 16px;
    transition: all 0.3s;
    background-color: #34495e;
    /* Dark Input BG */
    color: white;
    /* White Input Text */
}

#auth-container input::placeholder {
    color: #bdc3c7;
}

#auth-container input:focus {
    border-color: var(--primary-color);
    background-color: #2c3e50;
    box-shadow: 0 0 0 4px rgba(26, 188, 156, 0.2);
}

#auth-container button {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    margin-top: 10px;
    background-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(26, 188, 156, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    color: white;
    font-weight: bold;
    border-radius: var(--radius);
}

#auth-container button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 188, 156, 0.3);
}

/* Clean up old unused styles */

.tv-screen {
    width: 450px;
    /* Increased size to fill space */
    height: 300px;
    background: #000;
    border: 12px solid #333;
    border-radius: 12px;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

/* TV Stand base */
.tv-screen::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 20px;
    background: #222;
    border-radius: 0 0 5px 5px;
}

/* Slideshow Animation */
.tv-screen .slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    animation: slideShow 12s infinite;
}

/* Placeholder Gradients */
.slide-1 {
    background: linear-gradient(45deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
    animation-delay: 0s;
}

.slide-2 {
    background: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
    animation-delay: 4s;
}

.slide-3 {
    background: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%);
    animation-delay: 8s;
}

@keyframes slideShow {
    0% {
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    33% {
        opacity: 1;
    }

    43% {
        opacity: 0;
    }

    100% {
        opacity: 0;
    }
}

.auth-logo {
    max-width: 250px;
    height: auto;
    margin-bottom: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}



#auth-container h2 {
    color: white;
    margin-bottom: 30px;
    font-weight: 700;
    font-size: 1.5em;
    letter-spacing: -0.5px;
}

#auth-container input {
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 15px;
    border: 2px solid #34495e;
    /* Darker border */
    border-radius: var(--radius);
    font-size: 16px;
    transition: all 0.3s;
    background-color: #34495e;
    /* Dark input background */
    color: white;
    /* White text */
}

#auth-container input::placeholder {
    color: #bdc3c7;
}

#auth-container input:focus {
    border-color: var(--primary-color);
    background-color: #2c3e50;
    box-shadow: 0 0 0 4px rgba(26, 188, 156, 0.2);
}

#auth-container button {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    margin-top: 10px;
    background-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(26, 188, 156, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    color: white;
    font-weight: bold;
    border-radius: var(--radius);
}

#auth-container button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 188, 156, 0.4);
}

/* --- MAIN LAYOUT --- */
#app-container {
    display: none;
    height: 100vh;
    display: flex;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 25px;
    font-size: 1.4em;
    font-weight: bold;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.1);
    letter-spacing: 0.5px;
}

.sidebar-header h3 {
    color: white;
    border-bottom: none;
    margin-bottom: 0;
}

.nav-list {
    list-style-type: none;
    padding: 20px 0;
    margin: 0;
}

.nav-list li a {
    display: block;
    padding: 12px 25px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
    border-left: 4px solid transparent;
}

.nav-list li a:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
    padding-left: 30px;
    /* Slight slide effect */
}

.nav-list li a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: var(--accent-color);
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.2);
    font-size: 0.9em;
    text-align: center;
}

#user-email-display {
    display: block;
    margin-bottom: 10px;
    opacity: 0.8;
}

#logout-btn {
    background-color: var(--danger-color);
    font-size: 0.9em;
    padding: 8px;
}

/* --- CONTENT AREA --- */
.main-content {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    padding: 20px 40px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    margin: 0;
    font-size: 1.8em;
    color: var(--secondary-color);
}

.page-body {
    padding: 30px 40px;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- COMPONENTS --- */
h3 {
    color: var(--secondary-color);
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

button {
    padding: 10px 18px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: var(--radius);
    font-weight: 600;
    transition: background-color 0.2s;
    font-size: 0.95em;
}

button:hover {
    background-color: var(--primary-dark);
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #95a5a6;
}

.btn-danger {
    background-color: var(--danger-color);
}

input[type="text"],
input[type="url"],
input[type="file"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 10px 15px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    background-color: #fafafa;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: white;
}

/* --- CARDS & LISTS --- */
.card,
.list-item,
.screen-list-item,
.event-form {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.list-item {
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.list-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.list-header {
    display: flex;
    padding: 15px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
    background-color: transparent;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 10px;
}

/* --- DASHBOARD STATS GRID --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border-left: 5px solid var(--primary-color);
    display: flex;
    flex-direction: column;
}

.stat-card.online {
    border-left-color: var(--accent-color);
}

.stat-card.offline {
    border-left-color: var(--danger-color);
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--secondary-color);
    line-height: 1;
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- TAB SYSTEM --- */
.content-tabs {
    display: flex;
    gap: 5px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0px;
    margin-bottom: 20px;
}

.tab-link {
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-bottom: 3px solid transparent;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.2s;
    margin: 0;
}

.tab-link:hover {
    color: var(--primary-color);
}

.tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: transparent;
}

.tab-content {
    display: none;
    padding: 20px 0;
}

.tab-content.active {
    display: block;
}

/* Standardize input styles within tabs to match modals */
.tab-content input[type="text"],
.tab-content input[type="number"],
.tab-content input[type="url"],
.tab-content select,
.tab-content textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 15px;
    font-size: 1rem;
    color: var(--text-main);
    background-color: #fff;
    transition: border-color 0.2s;
    font-family: inherit;
}

.tab-content input:focus,
.tab-content select:focus,
.tab-content textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 188, 156, 0.1);
}

.tab-content label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--secondary-color);
    margin-top: 10px;
}

/* --- PLAYLIST & SCREEN FORMS --- */
.action-card {
    padding: 25px;
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    gap: 15px;
    align-items: center;
}

.input-group input {
    margin-bottom: 0;
}

.input-group button {
    width: auto;
    white-space: nowrap;
}

.screen-item-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.screen-config-form {
    padding: 20px;
    background-color: #f8f9fa;
    border-top: 1px solid var(--border-color);
}

/* --- PLAYLIST EDITOR --- */
.playlist-editor-container {
    display: flex;
    gap: 30px;
    min-height: 500px;
}

.playlist-form-section {
    flex: 3;
}

.playlist-media-library {
    flex: 2;
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    height: fit-content;
    max-height: 80vh;
    overflow-y: auto;
}

#playlist-items-container {
    background-color: #f8f9fa;
    border: 2px dashed #dce1e6;
    border-radius: var(--radius);
    padding: 15px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#playlist-items-container.drag-over {
    border-color: var(--primary-color);
    background-color: #eaf2f8;
}

.playlist-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 15px;
    align-items: center;
    padding: 12px 15px;
    margin: 0;
    background: white;
    cursor: grab;
}

.playlist-item-details strong {
    display: block;
    color: var(--secondary-color);
}

.playlist-item-details small {
    color: var(--text-muted);
}

.playlist-item-fit select,
.playlist-item-duration input {
    margin: 0;
    padding: 6px;
    width: auto;
}

/* --- MEDIA GRID (In Library) --- */
#playlist-media-list .list-item {
    padding: 10px;
    border: 1px solid transparent;
    border-bottom: 1px solid var(--border-color);
    box-shadow: none;
    margin: 0;
    border-radius: 0;
}

#playlist-media-list .list-item:hover {
    background-color: #f0f2f5;
    border-color: transparent;
    transform: none;
    box-shadow: none;
}

/* --- MODALS --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    justify-content: center;
    align-items: center;
    background-color: rgba(44, 62, 80, 0.8);
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: var(--radius);
    width: 600px;
    /* Default width */
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border: none;
}

.modal-actions {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-content label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--secondary-color);
}

.modal-content input[type="text"],
.modal-content input[type="number"],
.modal-content input[type="url"],
.modal-content select,
.modal-content textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 15px;
    font-size: 1rem;
    color: var(--text-main);
    background-color: #fff;
    transition: border-color 0.2s;
}

.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 188, 156, 0.1);
}

/* --- UTILS --- */
.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #95a5a6;
    /* Default (Offline) is Gray */
    margin-right: 8px;
}

.status-dot.online {
    background-color: #2ecc71;
    /* Online is Green */
    box-shadow: 0 0 5px #2ecc71;
}

.list-col-actions button {
    margin-left: 8px;
    font-size: 0.85em;
    padding: 6px 12px;
    opacity: 0.85;
}

.list-col-actions button:hover {
    opacity: 1;
}

.list-thumbnail,
.list-thumbnail-icon {
    width: 48px;
    height: 48px;
    border-radius: 6px;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    #app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
    }

    .playlist-editor-container {
        flex-direction: column;
    }
}