/* ============================================
   VMOS Cloud Platform — Premium Design System
   Dark Theme with Cyan/Electric Blue Accents
   ============================================ */

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

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
    /* Colors */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2035;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-card-hover: rgba(26, 32, 53, 0.9);
    --bg-glass: rgba(17, 24, 39, 0.6);
    --bg-input: rgba(15, 23, 42, 0.8);

    --border-primary: rgba(56, 189, 248, 0.15);
    --border-hover: rgba(56, 189, 248, 0.3);
    --border-active: rgba(56, 189, 248, 0.5);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-muted: #475569;

    --accent-primary: #38bdf8;
    --accent-secondary: #0ea5e9;
    --accent-gradient: linear-gradient(135deg, #38bdf8, #0ea5e9, #6366f1);
    --accent-glow: 0 0 20px rgba(56, 189, 248, 0.3);
    --accent-glow-strong: 0 0 40px rgba(56, 189, 248, 0.4);

    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.1);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.1);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.1);
    --info: #60a5fa;
    --info-bg: rgba(96, 165, 250, 0.1);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(56, 189, 248, 0.15);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(56, 189, 248, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(14, 165, 233, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

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

a:hover {
    color: var(--accent-secondary);
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

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

.login-container {
    width: 100%;
    max-width: 440px;
    padding: var(--space-xl);
}

.login-card {
    background: var(--bg-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: fadeInUp 0.6s ease-out;
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: var(--accent-gradient);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto var(--space-md);
    box-shadow: var(--accent-glow);
}

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

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: var(--space-xs);
}

.login-tabs {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-md);
}

.login-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    border: none;
    background: transparent;
}

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

/* ============================================
   Form Elements
   ============================================ */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1), var(--accent-glow);
}

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

select.form-input {
    cursor: pointer;
    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 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--accent-glow);
}

.btn-primary:hover {
    box-shadow: var(--accent-glow-strong);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    background: var(--bg-card-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #ef4444;
    box-shadow: 0 0 20px rgba(248, 113, 113, 0.3);
}

.btn-success {
    background: var(--success);
    color: #0a0e1a;
}

.btn-success:hover {
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover {
    color: var(--accent-primary);
    background: rgba(56, 189, 248, 0.1);
}

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

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

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-base);
}

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-primary);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: var(--accent-glow);
    flex-shrink: 0;
}

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

.sidebar-brand .brand-tag {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-lg);
}

.nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 var(--space-md);
    margin-bottom: var(--space-sm);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 10px var(--space-md);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(56, 189, 248, 0.05);
}

.nav-item.active {
    color: var(--accent-primary);
    background: rgba(56, 189, 248, 0.1);
}

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

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--accent-primary);
    color: var(--bg-primary);
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.sidebar-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-primary);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user .user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-role {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    text-transform: capitalize;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

.content-header {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(17, 24, 39, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.content-header .header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.content-body {
    padding: var(--space-xl);
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

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

.card-header h2 {
    font-size: 1.0625rem;
    font-weight: 600;
}

.card-body {
    padding: var(--space-lg);
}

.card-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* ============================================
   Stats Grid
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-base);
    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: opacity var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    border-color: var(--border-hover);
}

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

.stat-card .stat-icon {
    font-size: 1.5rem;
    margin-bottom: var(--space-md);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card .stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

/* ============================================
   Device Grid
   ============================================ */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-lg);
}

.device-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
    cursor: pointer;
}

.device-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md), var(--accent-glow);
    transform: translateY(-2px);
}

.device-card .device-preview {
    height: 180px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.device-card .device-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.device-card .device-preview .placeholder-icon {
    font-size: 3rem;
    opacity: 0.3;
}

.device-card .device-status {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-online {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.status-offline {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.status-initializing {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.device-card .device-info {
    padding: var(--space-lg);
}

.device-card .device-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.device-card .device-code {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    margin-bottom: var(--space-md);
}

.device-card .device-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

/* ============================================
   Tables
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-primary);
}

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

.data-table th {
    background: var(--bg-tertiary);
    padding: 12px var(--space-md);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-primary);
}

.data-table td {
    padding: 14px var(--space-md);
    font-size: 0.875rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-primary);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: rgba(56, 189, 248, 0.03);
}

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

/* ============================================
   Badges & Tags
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.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-admin {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-lg);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(20px);
    transition: transform var(--transition-base);
}

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

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

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

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-body {
    padding: var(--space-xl);
}

.modal-footer {
    padding: var(--space-md) var(--space-xl);
    border-top: 1px solid var(--border-primary);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* ============================================
   Toast / Notifications
   ============================================ */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-width: 300px;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease-out;
    border: 1px solid;
}

.toast-success {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
    border-color: rgba(52, 211, 153, 0.3);
}

.toast-error {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.3);
}

.toast-warning {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
    border-color: rgba(251, 191, 36, 0.3);
}

.toast-info {
    background: rgba(96, 165, 250, 0.15);
    color: var(--info);
    border-color: rgba(96, 165, 250, 0.3);
}

/* ============================================
   Stream Page
   ============================================ */
.stream-layout {
    display: flex;
    height: 100vh;
    background: #000;
    position: relative;
    z-index: 1;
}

.stream-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #040608;
    background-image:
        radial-gradient(ellipse at center, rgba(56, 189, 248, 0.04) 0%, transparent 70%),
        linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
    position: relative;
    overflow: hidden;
    padding: 12px;
}

.phone-frame {
    /* Scale to fill available height, keep 9:16 portrait ratio */
    height: calc(100vh - 24px);
    max-height: 780px;
    min-height: 400px;
    aspect-ratio: 9 / 16;
    width: auto;
    background: #0a0a0a;
    border-radius: 28px;
    overflow: hidden;
    border: 2px solid rgba(56, 189, 248, 0.35);
    box-shadow:
        0 0 0 4px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(56, 189, 248, 0.15),
        0 0 80px rgba(56, 189, 248, 0.08),
        var(--shadow-lg);
    position: relative;
    flex-shrink: 0;
}

.phone-frame #phoneBox {
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
}

.stream-controls {
    width: 64px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-md) 0;
    gap: var(--space-xs);
}

.stream-controls .ctrl-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
}

.stream-controls .ctrl-btn:hover {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-primary);
}

.stream-controls .ctrl-btn.active {
    color: var(--accent-primary);
    background: rgba(56, 189, 248, 0.15);
}

.stream-controls .ctrl-btn[title]::after {
    content: attr(title);
    position: absolute;
    right: 100%;
    margin-right: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    pointer-events: none;
}

.stream-controls .ctrl-btn:hover[title]::after {
    opacity: 1;
    visibility: visible;
}

.ctrl-divider {
    width: 32px;
    height: 1px;
    background: var(--border-primary);
    margin: var(--space-sm) 0;
}

.stream-sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.stream-sidebar .sidebar-top {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-primary);
}

.stream-sidebar .sidebar-body {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
}

.stream-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.stream-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.stream-status .status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

.stream-status .status-dot.connecting {
    background: var(--warning);
    animation: pulse 1s ease-in-out infinite;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-lg);
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.empty-state p {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin-bottom: var(--space-lg);
}

/* ============================================
   Tab System
   ============================================ */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: var(--space-xl);
}

.tab {
    padding: 12px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font-sans);
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* ============================================
   Loading
   ============================================ */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 26, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-primary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-card-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* ============================================
   Utility Classes
   ============================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.font-mono { font-family: var(--font-mono); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

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

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

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

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .stream-sidebar {
        display: none;
    }
    .phone-frame {
        height: calc(100vh - 16px);
        max-height: 600px;
        aspect-ratio: 9 / 16;
        width: auto;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .device-grid {
        grid-template-columns: 1fr;
    }
    .content-body {
        padding: var(--space-md);
    }
    .content-header {
        padding: var(--space-md);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .login-card {
        padding: var(--space-lg);
    }
}
