:root {
    --bg-app: #08080a;
    --bg-sidebar: #0d0d10;
    --bg-card: rgba(18, 18, 24, 0.75);
    --bg-card-hover: rgba(26, 26, 36, 0.9);
    --bg-subtle: rgba(255, 255, 255, 0.03);
    --bg-input: #111116;

    --primary-rgb: 212, 175, 55;
    --gold-main: #d4af37;
    --gold-light: #fbe69b;
    --gold-dark: #917118;
    --gold-glow: rgba(var(--primary-rgb), 0.35);
    --gold-border: rgba(var(--primary-rgb), 0.22);
    --gold-border-bright: rgba(var(--primary-rgb), 0.55);
    --gold-gradient: linear-gradient(135deg, #bf953f 0%, #fcf6ba 25%, #b38728 50%, #fbf5b7 75%, #aa771c 100%);
    --gold-text-gradient: linear-gradient(180deg, #fff6d6 0%, #d4af37 60%, #9c7b1f 100%);
    --bar-fill-gradient: linear-gradient(90deg, var(--gold-main) 0%, var(--gold-light) 100%);

    --text-primary: #f0f0f5;
    --text-muted: #8a8a9e;
    --text-dim: #555566;

    --accent-green: #00e676;
    --accent-cyan: #00e5ff;
    --accent-red: #ff3366;
    --accent-warning: #f59e0b;

    --sidebar-width: 260px;
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-app);
    background-image: 
        radial-gradient(circle at 10% 10%, rgba(212, 175, 55, 0.05) 0%, transparent 45%),
        radial-gradient(circle at 90% 90%, rgba(145, 113, 24, 0.04) 0%, transparent 45%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

code, .code-font {
    font-family: var(--font-mono);
}

/* Utilities */
.hidden { display: none !important; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.p-3 { padding: 1rem; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.max-w-600 { max-width: 600px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.7rem 1.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
    outline: none;
    letter-spacing: 0.2px;
}

.btn-primary {
    background: var(--gold-gradient);
    color: #121008;
    box-shadow: 0 4px 18px rgba(212, 175, 55, 0.28);
    font-weight: 800;
}
.btn-primary:hover {
    box-shadow: 0 6px 24px rgba(212, 175, 55, 0.55);
    transform: translateY(-2px);
    filter: brightness(1.08);
}
.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--gold-border);
}
.btn-secondary:hover {
    background: rgba(212, 175, 55, 0.12);
    border-color: var(--gold-main);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gold-border);
    color: var(--gold-light);
}
.btn-outline:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--gold-main);
    color: #fff;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.45rem 0.95rem;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-muted);
    padding: 0.45rem;
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover {
    color: var(--gold-light);
    background: rgba(212, 175, 55, 0.12);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #14141c;
    color: #fff;
    padding: 14px 22px;
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.85);
    border-left: 4px solid var(--gold-main);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: toastIn 0.3s ease;
    font-size: 0.92rem;
    font-weight: 600;
}
.toast.success { border-left-color: var(--accent-green); }
.toast.error { border-left-color: var(--accent-red); }

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

/* Login Overlay */
.login-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #14141c 0%, #08080a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-lg);
    padding: 44px 36px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(212, 175, 55, 0.1);
    text-align: center;
}

.login-brand-logo {
    width: 86px;
    height: auto;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 16px rgba(212, 175, 55, 0.4));
}

.login-header h2 {
    font-size: 1.7rem;
    font-weight: 900;
    margin-bottom: 6px;
    background: var(--gold-text-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 26px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    text-align: left;
}

.login-error {
    background: rgba(255, 51, 102, 0.15);
    border: 1px solid var(--accent-red);
    color: #ff809b;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    text-align: center;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--gold-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--gold-border);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo-img {
    width: 42px;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.35));
}

.brand-text h3 {
    font-size: 1.15rem;
    font-weight: 900;
    background: var(--gold-text-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.brand-sub {
    font-size: 0.72rem;
    color: var(--gold-main);
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.sidebar-nav {
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    color: var(--gold-light);
    background: rgba(212, 175, 55, 0.06);
    border-color: rgba(212, 175, 55, 0.15);
}

.nav-item.active {
    color: #121008;
    background: var(--gold-gradient);
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
    font-weight: 800;
}

.nav-item.active .badge {
    background: #121008;
    color: var(--gold-light);
    border-color: #121008;
}

.nav-item .badge {
    margin-left: auto;
    background: rgba(0, 230, 118, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(0, 230, 118, 0.3);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 800;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gold-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--gold-light);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 32px 42px;
    overflow-y: auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.topbar-title h1 {
    font-size: 1.9rem;
    font-weight: 900;
    background: var(--gold-text-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.topbar-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 3px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 230, 118, 0.1);
    border: 1px solid rgba(0, 230, 118, 0.3);
    color: var(--accent-green);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 800;
    position: relative;
}

.pulse-ring {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-green);
    opacity: 0.6;
    animation: pulse 1.8s infinite;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.6); opacity: 0; }
}

/* Tab Panes */
.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

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

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-md);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--gold-main);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 20px rgba(212, 175, 55, 0.15);
}

.stat-icon {
    font-size: 2.2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--gold-border);
    flex-shrink: 0;
}
.stat-icon.online { background: rgba(0, 230, 118, 0.1); border-color: rgba(0, 230, 118, 0.3); }
.stat-icon.vpn { background: rgba(212, 175, 55, 0.12); border-color: var(--gold-main); }
.stat-icon.devices { background: rgba(0, 229, 255, 0.1); border-color: rgba(0, 229, 255, 0.3); }
.stat-icon.version { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.3); }

.stat-info {
    display: flex;
    flex-direction: column;
}

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

.stat-value {
    font-size: 1.95rem;
    font-weight: 900;
    font-family: var(--font-mono);
    margin: 4px 0;
    color: var(--gold-light);
}

.stat-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Cards & Layout */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-md);
    padding: 26px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.card-header {
    margin-bottom: 22px;
}

.card-title h3 {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--gold-light);
}

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

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
@media (max-width: 900px) {
    .grid-2 { grid-template-columns: 1fr; }
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.form-group label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="number"],
textarea {
    background: var(--bg-input);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--font-main);
}

input:focus, textarea:focus {
    border-color: var(--gold-main);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

/* ==========================================================================
   LUXURY SWITCH & TOGGLE (Replaces ugly native browser checkbox)
   ========================================================================== */
.luxury-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    background: rgba(212, 175, 55, 0.04);
    border: 1px solid var(--gold-border);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}
.luxury-switch-wrapper:hover {
    border-color: var(--gold-main);
    background: rgba(212, 175, 55, 0.08);
}

.luxury-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}
.luxury-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.luxury-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 26px;
}
.luxury-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #8a8a9e;
    transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
}
.luxury-switch input:checked + .luxury-slider {
    background-color: rgba(var(--primary-rgb), 0.25);
    border-color: var(--gold-main);
    box-shadow: 0 0 14px var(--gold-glow);
}
.luxury-switch input:checked + .luxury-slider:before {
    transform: translateX(22px);
    background: var(--gold-gradient);
    box-shadow: 0 0 10px var(--gold-main);
}

.switch-label-group {
    display: flex;
    flex-direction: column;
}
.switch-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
}
.switch-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ==========================================================================
   CUSTOM DROPDOWN SELECT (Replaces native browser arrow & styling)
   ========================================================================== */
.custom-select-wrapper {
    position: relative;
    display: inline-block;
}

.select-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--bg-input);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23d4af37' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    padding: 10px 42px 10px 16px;
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    font-family: var(--font-main);
}
.select-input:hover, .select-input:focus {
    border-color: var(--gold-main);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}
.select-input option {
    background-color: #14141c;
    color: #fff;
    padding: 10px;
}

/* Search input with icon */
.search-input-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.search-input-wrapper .search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}
.search-input-wrapper .search-input {
    padding-left: 38px;
    min-width: 280px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th {
    padding: 14px 16px;
    background: rgba(212, 175, 55, 0.05);
    border-bottom: 1px solid var(--gold-border);
    color: var(--gold-light);
    font-weight: 800;
    white-space: nowrap;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 15px 16px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    white-space: nowrap;
}

.data-table tr:hover {
    background: rgba(212, 175, 55, 0.04);
}

.table-filters {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Badges & Dots */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 800;
}

.pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.status-pill.vpn {
    background: rgba(212, 175, 55, 0.18);
    color: var(--gold-light);
    border: 1px solid var(--gold-main);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}
.status-pill.vpn .pill-dot {
    background: var(--gold-main);
    box-shadow: 0 0 8px var(--gold-main);
}

.status-pill.app {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}
.status-pill.app .pill-dot {
    background: var(--accent-warning);
    box-shadow: 0 0 8px var(--accent-warning);
}

.status-pill.offline {
    background: rgba(138, 138, 158, 0.1);
    color: #8a8a9e;
    border: 1px solid rgba(138, 138, 158, 0.2);
}
.status-pill.offline .pill-dot {
    background: #6b7280;
}

.nav-icon {
    flex-shrink: 0;
    transition: transform 0.2s;
}
.nav-item:hover .nav-icon {
    transform: scale(1.1);
}

.upload-icon-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

/* Upload Dropzone */
.upload-zone {
    border: 2px dashed var(--gold-border);
    border-radius: var(--radius-md);
    padding: 38px 24px;
    text-align: center;
    background: rgba(212, 175, 55, 0.03);
    transition: all 0.25s;
    cursor: pointer;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--gold-main);
    background: rgba(212, 175, 55, 0.08);
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.15);
}
.upload-icon {
    font-size: 3.2rem;
    margin-bottom: 12px;
}

.progress-bar-container {
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--gold-border);
}

.progress-bar {
    height: 100%;
    background: var(--gold-gradient);
    color: #121008;
    font-size: 0.8rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 0%;
    transition: width 0.2s;
}

.info-box {
    background: rgba(212, 175, 55, 0.04);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-sm);
    display: flex;
    gap: 14px;
}
.info-icon { font-size: 1.6rem; }

.copy-url-box {
    display: flex;
    gap: 8px;
    width: 100%;
}
.copy-url-box input {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-container { flex-direction: column; }
    .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--gold-border); }
    .main-content { padding: 20px 16px; }
}
