/* ═══════════════════════════════════════════════════════
   🌊 DVBSOLUTION - Base Styles
   ═══════════════════════════════════════════════════════ */

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

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-deep);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover { color: var(--accent-teal); }

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-teal); }

/* ═══ LAYOUT ═══ */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 20px;
    max-width: 1920px;
    margin: 0 auto;
    width: 100%;
}

/* ═══ HEADER ═══ */
.app-header {
    height: var(--header-height);
    background: var(--gradient-header);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-cyan);
}

.header-logo span { font-size: 24px; }

.header-nav {
    display: flex;
    gap: 5px;
    margin-left: 40px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}
.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.nav-link.active {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
}
.header-user:hover { border-color: var(--border-hover); }

/* ═══ PAGE HEADER ═══ */
/* All elements in page-header should be 44px height for consistency */
.page-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    min-height: 44px;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 16px;
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 8px;
}

.page-title h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-cyan);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.page-title h1 span {
    font-size: 18px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 44px;
}

.page-actions .btn,
.page-actions button {
    height: 44px;
    padding: 0 20px;
}

/* Notification zone / Info panel - already 44px */
#notification-zone {
    height: 44px !important;
}

#notification-zone .notification-box {
    height: 44px !important;
    padding: 0 20px !important;
}

/* ═══ BUTTONS ═══ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.3);
    color: var(--accent-teal);
}
.btn-primary:hover {
    background: rgba(6, 182, 212, 0.25);
    border-color: var(--accent-teal);
}

.btn-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success);
}
.btn-success:hover {
    background: rgba(16, 185, 129, 0.25);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 14px;
}

/* ═══ CARDS ═══ */
.card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 20px;
}

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

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ═══ TABLES ═══ */
.table-container {
    background: rgba(13, 33, 55, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

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

thead {
    background: var(--gradient-header);
}

th {
    padding: 12px 8px;
    text-align: center;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(6, 182, 212, 0.15);
    white-space: nowrap;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}
th.sortable:hover {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-teal);
}

.sort-icon {
    font-size: 10px;
    opacity: 0.4;
    margin-left: 3px;
}
th.sorted .sort-icon { opacity: 1; }

td {
    padding: 8px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr {
    transition: background 0.2s;
}
tbody tr:hover {
    background: rgba(6, 182, 212, 0.04);
}
tbody tr.running {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.08) 0%, transparent 30%);
    border-left: 2px solid var(--success);
}

/* ═══ BADGES ═══ */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    min-width: 40px;
    height: 24px;
    border-radius: var(--border-radius-sm);
    font-size: 10px;
    font-weight: 600;
}

.badge-default {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

.badge-info {
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.25);
    color: var(--accent-teal);
}

.badge-purple {
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: var(--accent-purple);
}

/* ═══ STATUS BADGES ═══ */
.status-online {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.status-offline {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.status-running {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.status-stopped {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* ═══ SIGNAL BARS ═══ */
.signal-bar {
    position: relative;
    width: 60px;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.signal-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.signal-bar-fill.green { background: linear-gradient(90deg, #10b981, #34d399); }
.signal-bar-fill.yellow { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.signal-bar-fill.red { background: linear-gradient(90deg, #ef4444, #f87171); }
.signal-bar-fill.cyan { background: linear-gradient(90deg, #06b6d4, #22d3ee); }

.signal-bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 9px;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ═══ INPUTS ═══ */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 13px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

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

select.form-control {
    cursor: pointer;
}

/* ═══ MODALS ═══ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    transform: scale(0.9);
    transition: transform 0.2s;
}

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

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

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    border-radius: var(--border-radius);
}
.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid var(--border);
}

/* ═══ TOASTS ═══ */

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

/* ═══ LOADING ═══ */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ═══ FILTER BOX ═══ */
.filter-box {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
}

.filter-input {
    width: 250px;
    height: 44px;
    padding: 0 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
}
.filter-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

/* ═══ ACTION BUTTONS ═══ */
.actions-cell {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.btn-action {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover:not(:disabled) {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-action.start:hover:not(:disabled) { color: var(--success); border-color: var(--success); }
.btn-action.stop:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }
.btn-action.edit:hover:not(:disabled) { color: var(--accent-cyan); border-color: var(--accent-cyan); }
.btn-action.delete:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }

.btn-action:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ═══ UTILITIES ═══ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-cyan { color: var(--accent-cyan); }
.text-purple { color: var(--accent-purple); }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════
   🌌 DEPTH SHADOWS FOR ALL CARDS/MODALS
   ═══════════════════════════════════════════════════════ */
.table-container,
.card,
.modal-content,
.modal,
.channels-modal-content {
    box-shadow: 
        0 0 20px rgba(6, 182, 212, 0.1),
        0 0 40px rgba(6, 182, 212, 0.05),
        0 15px 35px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.03) !important;
}

