/* ============================================
   Corporate TV Manager - Design System
   Premium dark theme with glassmorphism
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* === CSS Variables === */
:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-card: rgba(26, 26, 26, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.02);
    --bg-glass-hover: rgba(255, 255, 255, 0.05);
    --bg-input: rgba(255, 255, 255, 0.03);
    
    --border-color: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(168, 218, 220, 0.5);
    
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --text-muted: #6c757d;
    --text-dark: #212529;
    
    --accent-primary: #a8dadc;
    --accent-primary-hover: #b8e0e2;
    --accent-secondary: #f4a261;
    --accent-gradient: linear-gradient(135deg, rgb(34, 202, 247), rgb(155, 54, 247));
    --accent-glow: 0 0 20px rgba(168, 218, 220, 0.3);
    
    --success: #95d5b2;
    --success-bg: rgba(149, 213, 178, 0.1);
    --warning: #f4a261;
    --warning-bg: rgba(244, 162, 97, 0.1);
    --danger: #e76f51;
    --danger-bg: rgba(231, 111, 81, 0.1);
    --info: #a8dadc;
    --info-bg: rgba(168, 218, 220, 0.1);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
    
    --sidebar-width: 280px;
    --header-height: 64px;
}

/* Bootstrap Icons */
.bi {
    color: white;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

/* === Reset === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Background Pattern === */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.02) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(255, 255, 255, 0.01) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

a { color: var(--accent-primary); text-decoration: none; transition: var(--transition-fast); }
a:hover { color: var(--accent-primary-hover); }

/* === Layout === */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: left var(--transition);
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sidebar-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--accent-gradient);
    border-radius: 0 2px 2px 0;
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary-hover);
}

.nav-item.active::before {
    height: 60%;
}

.nav-item .icon {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* === Main Content === */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.content-header {
    padding: 20px 32px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 15, 15, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.content-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
}

.content-header h1 span {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.85rem;
    margin-left: 8px;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.content-body {
    padding: 32px;
}

/* === Cards === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

/* === Stat Cards === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(10px);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 16px;
}

.stat-icon.purple { background: rgba(99, 102, 241, 0.12); color: #818cf8; }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.blue { background: var(--info-bg); color: var(--info); }

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--accent-glow);
}
.btn-primary:hover {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
    color: white;
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-glass-hover);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.btn-success:hover {
    background: rgba(16, 185, 129, 0.2);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* === Forms === */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 10px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control::placeholder { color: var(--text-muted); }

/* Keep date/datetime picker icon visible on dark theme */
input[type="date"].form-control::-webkit-calendar-picker-indicator,
input[type="datetime-local"].form-control::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.9;
    cursor: pointer;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

select.form-control option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* === Tables === */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 14px 16px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-glass);
}

tbody td {
    padding: 14px 16px;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-color);
}

tbody tr {
    transition: var(--transition-fast);
}

tbody tr:hover {
    background: var(--bg-glass-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-purple { background: rgba(139, 92, 246, 0.12); color: #a78bfa; }

/* Pulse indicator */
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.pulse-dot.online {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
    animation: pulse 2s infinite;
}

.pulse-dot.offline {
    background: var(--text-muted);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 24px 28px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-glass);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 0 28px 24px;
}

.modal-footer {
    padding: 16px 28px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* === Toast Notifications === */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.85rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease;
    min-width: 300px;
    max-width: 450px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--info); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.85rem;
    margin-bottom: 20px;
}

/* === Grid Layouts === */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* === TV Card (Environment View) === */
.tv-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.tv-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tv-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.tv-card-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.tv-card-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.tv-card-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tv-card-url {
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent-primary-hover);
    word-break: break-all;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tv-orientation-icon {
    font-size: 1.5rem;
}

/* === Environment Card === */
.env-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
    cursor: pointer;
}

.env-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.env-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.env-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(99, 102, 241, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.env-card-name {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.env-card-location {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.env-card-stats {
    display: flex;
    gap: 20px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.env-stat {
    text-align: center;
}

.env-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
}

.env-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* === Login Page === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-xl);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    overflow: hidden;
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

.login-card .form-control {
    padding: 12px 16px;
}

.login-card .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 0.95rem;
}

.login-error {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
}

/* === Schedule Card for calendar view === */
.schedule-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.schedule-item:hover {
    border-color: var(--border-color);
}

.schedule-time {
    text-align: center;
    min-width: 60px;
}

.schedule-time .date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.schedule-time .time {
    font-size: 0.85rem;
    font-weight: 600;
}

.schedule-details {
    flex: 1;
}

.schedule-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.schedule-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.schedule-guest {
    display: flex;
    align-items: center;
    gap: 8px;
}

.schedule-guest img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* === Responsive === */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
    .sidebar { left: -280px; }
    .sidebar.open { left: 0; }
    .main-content { margin-left: 0; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .content-body { padding: 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    
    /* Mobile enhancements */
    .content-header h1 { 
        font-size: 1.2rem; 
        width: 100%;
        display: flex;
        gap: 5px;
        align-items: center;
    }
    .sidebar-close { display: block; }
    .btn { padding: 12px 16px; font-size: 0.9rem; min-height: 44px; }
    .btn-sm { padding: 8px 12px; min-height: 40px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 1.8rem; }
    .card-body { padding: 16px; }
    .form-control { padding: 12px 16px; font-size: 1rem; }
    .modal { width: 95%; max-width: none; margin: 10px; }
    .modal-body, .modal-footer { padding: 16px; }
    .table-wrapper { font-size: 0.85rem; }
    .nav-item { padding: 12px 16px; font-size: 1rem; }
    .user-avatar { width: 40px; height: 40px; }
    .header-actions { flex-direction: column; gap: 8px; }
    .header-actions .btn { width: 100%; justify-content: center; }
}

/* === Loading State === */
.skeleton {
    background: linear-gradient(90deg, var(--bg-glass) 25%, var(--bg-glass-hover) 50%, var(--bg-glass) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === Copy URL animation === */
.copied-feedback {
    animation: copiedPop 0.3s ease;
}

@keyframes copiedPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* === Activity Log === */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.82rem;
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.activity-content {
    flex: 1;
}

.activity-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* === Mobile menu toggle === */
.mobile-menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    margin-right: 1rem;
    background: rgba(99, 102, 241, 0.14);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.mobile-menu-toggle:hover {
    background: rgba(99, 102, 241, 0.22);
    border-color: rgba(99, 102, 241, 0.5);
}

@media (max-width: 1024px) {
    .mobile-menu-toggle {
        display: inline-flex;
    }
}

@media (max-width: 768px) {
    .content-header {
        padding: 16px;
        align-items: flex-start;
        gap: 10px;
        flex-direction: column;
    }

    .content-header h1 {
        font-size: 1.05rem;
        line-height: 1.2;
    }

    .content-body {
        padding: 14px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .schedule-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .schedule-time {
        width: 100%;
        text-align: left;
        min-width: 0;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
    }

    .schedule-time .date,
    .schedule-time .time {
        font-size: 0.78rem;
    }

    .schedule-item .schedule-details {
        width: 100%;
    }

    .schedule-item > div:last-child {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .schedule-item > div:last-child .btn {
        flex: 1;
        justify-content: center;
    }

    #page-tvs .table-wrapper {
        overflow: visible;
    }

    #page-tvs table,
    #page-tvs thead,
    #page-tvs tbody,
    #page-tvs th,
    #page-tvs td,
    #page-tvs tr {
        display: block;
        width: 100%;
    }

    #page-tvs thead {
        display: none;
    }

    #page-tvs tbody tr {
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        background: var(--bg-glass);
        margin-bottom: 12px;
        padding: 8px 10px;
    }

    #page-tvs tbody td {
        border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
        padding: 8px 4px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        font-size: 0.84rem;
    }

    #page-tvs tbody td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        min-width: 86px;
    }

    #page-tvs tbody td:last-child {
        border-bottom: none;
        justify-content: flex-end;
    }

    #page-tvs tbody td:last-child::before {
        display: none;
    }
}

/* === Orientation selector === */
.orientation-select {
    display: flex;
    gap: 12px;
}

.orientation-option {
    flex: 1;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    transition: var(--transition-fast);
}

.orientation-option:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.orientation-option.selected {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.08);
}

.orientation-option .icon {
    font-size: 2rem;
    margin-bottom: 4px;
}

.orientation-option .label {
    font-size: 0.78rem;
    font-weight: 600;
}

/* === Content type selector === */
.content-type-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.content-type-option {
    padding: 14px 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    transition: var(--transition-fast);
}

.content-type-option:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.content-type-option.selected {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.08);
}

.content-type-option .icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.content-type-option .label {
    font-size: 0.72rem;
    font-weight: 600;
}

/* === Tab group for checkbox === */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.checkbox-item {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.checkbox-item.selected {
    background: rgba(99, 102, 241, 0.12);
    border-color: var(--accent-primary);
    color: var(--accent-primary-hover);
}

/* === File upload zone === */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.04);
}

.upload-zone .icon {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.upload-zone p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* === Media Tabs === */
.media-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    padding: 4px;
    width: fit-content;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.media-tab {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--text-muted);
    border: none;
    background: none;
    font-family: inherit;
}

.media-tab.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-sm);
}

.media-tab:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}

/* === Media Grid === */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.media-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
}

.media-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.media-card-thumb {
    height: 140px;
    background: var(--bg-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    position: relative;
    overflow: hidden;
}

.media-card-thumb.video-thumb {
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.08));
}

.media-card-thumb.html-thumb {
    background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(59,130,246,0.08));
    font-size: 2.5rem;
    flex-direction: column;
    gap: 8px;
}

.media-card-thumb .html-preview {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.55rem;
    color: var(--text-muted);
    max-width: 90%;
    text-align: left;
    overflow: hidden;
    max-height: 50px;
    line-height: 1.4;
    opacity: 0.7;
}

.media-card-actions {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: var(--transition-fast);
}

.media-card:hover .media-card-actions {
    opacity: 1;
}

.media-card-info {
    padding: 12px 16px;
}

.media-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-card-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.media-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.media-type-badge.video { background: rgba(99,102,241,0.15); color: #818cf8; }
.media-type-badge.html { background: rgba(16,185,129,0.15); color: #34d399; }

/* === Confirm Overlay === */
.confirm-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.confirm-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: scaleIn 0.2s ease;
}

.confirm-box .confirm-icon { font-size: 3rem; margin-bottom: 16px; }
.confirm-box h3 { font-size: 1.1rem; margin-bottom: 8px; }
.confirm-box p { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 24px; }
.confirm-actions { display: flex; gap: 12px; justify-content: center; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* === HTML Editor in Modal === */
.html-editor {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.82rem;
    min-height: 160px;
    line-height: 1.5;
    background: rgba(0,0,0,0.3);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.html-editor:focus {
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* === Section header with actions === */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

/* === Upload progress === */
.upload-progress {
    margin-top: 16px;
    display: none;
}

.progress-bar {
    height: 4px;
    background: var(--bg-glass);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

/* === Improved danger button for delete === */
.btn-delete {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.3);
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-delete:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
}

/* Improved scrollbar inside modals */
.modal::-webkit-scrollbar { width: 4px; }
.modal::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
