* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f97316;
    --danger: #ef4444;
    --dark-bg: #0f172a;
    --dark-surface: #1e293b;
    --dark-surface-light: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #475569;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--dark-bg);
    color: var(--text-primary);
    height: 100%;
}

.layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 240px;
    background: var(--dark-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
}

.sidebar-header {
    margin-bottom: 30px;
}

.logo-nexus {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.logo-icon {
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 8px;
}

.sidebar-menu {
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    color: var(--text-secondary);
}

.menu-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

.menu-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    color: var(--primary);
    border-left: 3px solid var(--primary);
    padding-left: 11px;
}

.menu-icon {
    font-size: 18px;
}

.menu-label {
    font-size: 13px;
    font-weight: 500;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 20px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 8px;
    margin-bottom: 12px;
}

.user-avatar {
    font-size: 24px;
}

.user-info {
    font-size: 12px;
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.user-role {
    color: var(--text-muted);
}

.logout-btn {
    width: 100%;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== TOPBAR ===== */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--dark-surface);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.topbar-left {
    flex: 1;
    max-width: 300px;
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--success);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.lang-btn, .notifications-bell, .user-menu-icon {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s;
    position: relative;
}

.lang-btn:hover, .notifications-bell:hover, .user-menu-icon:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.notification-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* ===== CONTENT ===== */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 900;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.page-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===== STATS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s;
}

.stat-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 28px;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-change {
    color: var(--success);
    font-size: 13px;
    font-weight: 600;
}

/* ===== CHARTS ===== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 16px;
}

.chart-card {
    background: var(--dark-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.chart-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== TABLES ===== */
.section-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.table-container {
    background: var(--dark-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
    border-bottom: 2px solid var(--border);
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-primary);
}

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.actions-cell {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s;
}

.action-btn:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.action-btn.play:hover {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.action-btn.delete:hover {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.action-btn-menu {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-online {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
}

.badge-offline {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-secondary);
}

.badge-issues {
    background: rgba(249, 115, 22, 0.15);
    color: #fed7aa;
}

.badge-activo {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
}

.badge-vencido {
    background: rgba(249, 115, 22, 0.15);
    color: #fed7aa;
}

.badge-baneado {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.badge-deshabilitado {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-secondary);
}

.cost-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
}

.cost-0 {
    background: rgba(107, 114, 128, 0.2);
    color: #cbd5e1;
}

.cost-1 {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
}

.cost-25 {
    background: rgba(249, 115, 22, 0.2);
    color: #fed7aa;
}

.cost-5 {
    background: rgba(249, 115, 22, 0.2);
    color: #fed7aa;
}

.cost-9 {
    background: rgba(139, 92, 246, 0.2);
    color: #ddd6fe;
}

.content-badge {
    display: inline-block;
    padding: 4px 8px;
    background: rgba(99, 102, 241, 0.15);
    color: #bfdbfe;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 4px;
}

.msg-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.msg-badge.warning {
    background: rgba(234, 179, 8, 0.15);
    color: #fde047;
}

.msg-badge.info {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

.msg-badge.urgent {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

/* ===== BUTTONS ===== */
.btn-primary, .btn-warning, .btn-secondary {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #ea580c);
    color: white;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.4);
}

/* ===== USERS SECTION ===== */
.users-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.users-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.user-tab {
    background: none;
    border: none;
    padding: 8px 0;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.user-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ===== SERVERS ===== */
.ai-analysis {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 16px;
    border-radius: 8px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
    letter-spacing: 0.5px;
}

.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.server-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s;
}

.server-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
}

.server-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.server-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.server-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.server-badge.online {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.server-badge.carga {
    background: rgba(249, 115, 22, 0.2);
    color: #fed7aa;
}

.server-badge.mantenimiento {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.server-location {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.server-metrics {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.metric {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.metric-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 60px;
    text-transform: uppercase;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.progress {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.metric-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 50px;
    text-align: right;
}

/* ===== SETTINGS ===== */
.settings-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    flex-wrap: wrap;
}

.settings-tab {
    background: none;
    border: none;
    padding: 10px 0;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.settings-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.settings-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.settings-panel {
    display: none;
}

.settings-panel.active {
    display: block;
    grid-column: 1;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label, .form-group > small {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group > small {
    margin-bottom: 4px;
    margin-top: -4px;
}

.form-input, .form-select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    transition: all 0.3s;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.panel-info {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    grid-column: 2;
    height: fit-content;
    position: sticky;
    top: 0;
}

.panel-info h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row span {
    color: var(--text-secondary);
}

.info-row strong {
    color: var(--text-primary);
    font-weight: 700;
}

/* ===== VOD ===== */
.vod-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.vod-tab {
    background: none;
    border: none;
    padding: 8px 0;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.vod-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.vod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.vod-card {
    cursor: pointer;
    transition: all 0.3s;
}

.vod-poster {
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.vod-card:hover .vod-poster {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2);
    transform: translateY(-4px);
}

.vod-info h4 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

.vod-info p {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.vod-genre {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(99, 102, 241, 0.2);
    color: #bfdbfe;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-surface-light);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .settings-content {
        grid-template-columns: 1fr;
    }

    .panel-info {
        grid-column: 1;
    }
}

@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        padding: 12px 16px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-menu {
        display: none;
    }

    .topbar {
        flex-direction: column;
        gap: 12px;
    }

    .topbar-left, .topbar-right {
        width: 100%;
        max-width: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th, .data-table td {
        padding: 12px;
    }

    .servers-grid {
        grid-template-columns: 1fr;
    }

    .vod-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}