/* ─── Variables ─────────────────────────────────────────────────── */
:root {
    --bg: #0a0e1a;
    --bg-surface: #111827;
    --bg-elevated: #1a2234;
    --bg-hover: #1f2d42;
    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.14);

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

    --accent: #0066FF;
    --accent-light: #3385ff;
    --accent-glow: rgba(0, 102, 255, 0.2);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);

    --font-sans: 'Inter', system-ui, sans-serif;
    --font-display: 'Space Grotesk', system-ui, sans-serif;
}

/* ─── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-light); }

/* ─── Navbar ─────────────────────────────────────────────────────── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 60px;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 24px;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.brand-logo svg { width: 28px; height: 28px; }
.brand-name {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}
.brand-fiber { color: var(--accent); }

.navbar-center {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}
.nav-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 8px;
    transition: all 0.15s;
}
.nav-link:hover { background: var(--bg-elevated); color: var(--text-primary); }
.nav-link.active { background: var(--accent-glow); color: var(--accent-light); }

.navbar-right { display: flex; align-items: center; }

/* User Menu */
.user-menu { position: relative; }
.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 12px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.15s;
}
.user-btn:hover { background: var(--bg-elevated); border-color: var(--border-strong); }
.user-avatar {
    width: 30px; height: 30px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; align-items: flex-start; }
.user-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.chevron { width: 14px; height: 14px; stroke: var(--text-muted); transition: transform 0.2s; }
.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    min-width: 160px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.user-dropdown.open { display: block; }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.1s;
}
.dropdown-item svg { width: 14px; height: 14px; }
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item.logout:hover { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ─── Main Content ───────────────────────────────────────────────── */
.main-content { min-height: calc(100vh - 60px); }

/* ─── Flash Messages ─────────────────────────────────────────────── */
.flash-container {
    position: fixed;
    top: 72px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}
.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.2s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } }
.flash button {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 18px; line-height: 1;
    flex-shrink: 0;
}
.flash-success { border-left: 3px solid var(--success); }
.flash-danger  { border-left: 3px solid var(--danger); }
.flash-warning { border-left: 3px solid var(--warning); }
.flash-info    { border-left: 3px solid var(--info); }

/* ─── Auth Pages ─────────────────────────────────────────────────── */
.auth-page { background: var(--bg); }
.auth-container {
    min-height: 100vh;
    display: flex;
}
.auth-left {
    width: 42%;
    background: linear-gradient(135deg, #0a0e1a 0%, #0d1829 60%, #0a1533 100%);
    padding: 60px 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}
.auth-left::before {
    content: '';
    position: absolute;
    top: -100px; left: -100px;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(0,102,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.auth-logo svg { width: 44px; height: 44px; }
.auth-brand-name {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}
.auth-brand-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.auth-tagline { }
.auth-tagline h2 {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
    line-height: 1.15;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 16px;
}
.auth-tagline p { color: var(--text-secondary); font-size: 15px; line-height: 1.6; }
.auth-features { display: flex; flex-direction: column; gap: 12px; }
.auth-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}
.feat-icon { font-size: 18px; }

.auth-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
}
.auth-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin-bottom: 6px;
}
.auth-subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 32px; }

/* Centered auth (reset password) */
.auth-centered { justify-content: center; align-items: center; padding: 40px 24px; }
.auth-card-solo {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}
.auth-logo-sm {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 28px;
}
.auth-logo-sm svg { width: 28px; height: 28px; }
.auth-logo-sm span { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.auth-footer-link { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); }

/* ─── Forms ──────────────────────────────────────────────────────── */
.auth-form, .admin-form { display: flex; flex-direction: column; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.label-link { font-size: 12px; color: var(--accent); font-weight: 400; }
.label-link:hover { color: var(--accent-light); }
.form-group input,
.form-group select {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 11px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-sans);
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group input::placeholder { color: var(--text-muted); }
.form-hint { font-size: 12px; color: var(--text-muted); }
.input-wrapper { position: relative; }
.input-wrapper input { padding-right: 44px; }
.toggle-pw {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: var(--text-muted);
    padding: 4px;
}
.toggle-pw svg { width: 18px; height: 18px; }
.form-check {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--text-secondary);
}
.form-check input[type="checkbox"] {
    width: 16px; height: 16px; flex-shrink: 0;
    accent-color: var(--accent);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-divider { height: 1px; background: var(--border); margin: 4px 0; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 4px; }

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--accent);
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px; font-weight: 600;
    border: none; cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    font-family: var(--font-sans);
}
.btn-primary:hover { background: var(--accent-light); color: #fff; transform: translateY(-1px); }
.btn-primary svg { width: 16px; height: 16px; }
.btn-primary.btn-full { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }

.btn-secondary {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px; font-weight: 500;
    border: 1px solid var(--border);
    cursor: pointer; transition: all 0.15s;
    text-decoration: none;
    font-family: var(--font-sans);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }

.btn-danger {
    background: var(--danger); color: #fff;
    padding: 10px 20px; border-radius: var(--radius);
    font-size: 14px; font-weight: 600; border: none; cursor: pointer;
    transition: all 0.15s; font-family: var(--font-sans);
}
.btn-danger:hover { background: #dc2626; }
.btn-danger-outline {
    background: transparent; color: var(--danger);
    padding: 10px 20px; border-radius: var(--radius);
    font-size: 14px; font-weight: 500;
    border: 1px solid rgba(239, 68, 68, 0.3);
    cursor: pointer; transition: all 0.15s; font-family: var(--font-sans);
}
.btn-danger-outline:hover { background: rgba(239,68,68,0.1); }
.btn-success {
    background: var(--success); color: #fff;
    padding: 10px 20px; border-radius: var(--radius);
    font-size: 14px; font-weight: 600; border: none; cursor: pointer; font-family: var(--font-sans);
}
.btn-table {
    font-size: 13px; color: var(--accent); font-weight: 500;
    padding: 4px 12px; border-radius: 6px;
    border: 1px solid var(--accent-glow); transition: all 0.15s;
}
.btn-table:hover { background: var(--accent-glow); color: var(--accent-light); }

/* ─── Role Badges ────────────────────────────────────────────────── */
.role-badge {
    font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 100px;
    text-transform: uppercase; letter-spacing: 0.5px;
    display: inline-block;
}
.role-admin      { background: rgba(239,68,68,0.15); color: #f87171; }
.role-management { background: rgba(168,85,247,0.15); color: #c084fc; }
.role-tech       { background: rgba(6,182,212,0.15); color: #22d3ee; }
.role-sales      { background: rgba(16,185,129,0.15); color: #34d399; }
.role-office     { background: rgba(249,115,22,0.15); color: #fb923c; }
.role-msp        { background: rgba(245,158,11,0.15); color: #fbbf24; }

/* Status badges */
.status-badge {
    font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 100px;
    letter-spacing: 0.3px;
}
.status-active   { background: rgba(16,185,129,0.12); color: var(--success); }
.status-inactive { background: rgba(100,116,139,0.12); color: var(--text-muted); }

/* Item badges */
.item-badge {
    font-size: 10px; font-weight: 600;
    padding: 1px 6px; border-radius: 4px;
    letter-spacing: 0.3px; margin-left: 6px;
}
.badge-live     { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-lan-only { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-vpn-only { background: rgba(168,85,247,0.15); color: #c084fc; }
.badge-internal { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-beta     { background: rgba(249,115,22,0.15); color: #fb923c; }
.badge-external { background: rgba(100,116,139,0.12); color: var(--text-muted); }

/* ─── Dashboard ──────────────────────────────────────────────────── */
.dashboard-page { padding: 32px 40px; max-width: 1400px; margin: 0 auto; }
.dashboard-header {
    display: flex; align-items: flex-start;
    justify-content: space-between; gap: 20px;
    margin-bottom: 36px;
}
.page-title {
    font-family: var(--font-display);
    font-size: 28px; font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}
.page-sub { font-size: 14px; color: var(--text-secondary); }
.header-search input {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 9px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    width: 240px;
    transition: all 0.15s;
}
.header-search input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    width: 280px;
}
.header-search input::placeholder { color: var(--text-muted); }

.portal-section { margin-bottom: 40px; }
.section-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 16px;
}
.section-header h2 {
    font-family: var(--font-display);
    font-size: 16px; font-weight: 600;
    color: var(--text-secondary);
    display: flex; align-items: center; gap: 8px;
}
.section-icon { font-size: 16px; }
.section-count {
    font-size: 12px; font-weight: 600;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 2px 8px; border-radius: 100px;
    color: var(--text-muted);
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.portal-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: all 0.15s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}
.portal-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(0,102,255,0.03));
    opacity: 0;
    transition: opacity 0.15s;
}
.portal-card:hover {
    border-color: rgba(0,102,255,0.4);
    background: var(--bg-elevated);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    color: inherit;
}
.portal-card:hover::before { opacity: 1; }
.portal-card:hover .card-arrow { opacity: 1; transform: translateX(0); }
.card-lan { border-left: 2px solid rgba(245,158,11,0.4); }

.card-icon { font-size: 24px; flex-shrink: 0; }
.card-body { flex: 1; min-width: 0; }
.card-title {
    font-size: 14px; font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 3px;
    display: flex; align-items: center;
}
.card-desc {
    font-size: 12px; color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-arrow {
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.15s;
    flex-shrink: 0;
}
.card-arrow svg { width: 16px; height: 16px; stroke: var(--accent); }

/* Empty state */
.empty-state {
    text-align: center; padding: 80px 40px;
    color: var(--text-muted);
}
.empty-state span { font-size: 48px; display: block; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ─── Admin Pages ────────────────────────────────────────────────── */
.admin-page { padding: 32px 40px; max-width: 1200px; margin: 0 auto; }
.admin-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.form-card { padding: 28px; }
.card-section-title {
    font-family: var(--font-display);
    font-size: 15px; font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Table */
.table-toolbar {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.table-toolbar input {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    width: 220px;
}
.table-toolbar input:focus { outline: none; border-color: var(--accent); }
.table-count { font-size: 13px; color: var(--text-muted); }
.table-wrapper { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    padding: 12px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-elevated); }
.row-inactive td { opacity: 0.55; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.table-avatar {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }

/* Edit grid */
.edit-grid { display: grid; grid-template-columns: 1fr 380px; gap: 20px; align-items: start; }
.edit-right-col { display: flex; flex-direction: column; gap: 20px; }
.danger-card { border-color: rgba(239,68,68,0.2); }
.danger-title { color: var(--danger); }

/* ─── Error Page ─────────────────────────────────────────────────── */
.error-page {
    min-height: 100vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center; padding: 40px;
}
.error-code {
    font-family: var(--font-display);
    font-size: 96px; font-weight: 800;
    color: var(--accent); opacity: 0.3;
    line-height: 1; margin-bottom: 16px;
}
.error-page h2 { font-size: 24px; font-weight: 700; margin-bottom: 12px; }
.error-page p { color: var(--text-secondary); font-size: 15px; margin-bottom: 28px; max-width: 480px; }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .auth-left { display: none; }
    .auth-right { padding: 40px 20px; }
    .dashboard-page, .admin-page { padding: 24px 16px; }
    .dashboard-header { flex-direction: column; gap: 16px; }
    .header-search input { width: 100% !important; }
    .form-row { grid-template-columns: 1fr; }
    .edit-grid { grid-template-columns: 1fr; }
    .navbar { padding: 0 16px; }
    .user-info { display: none; }
    .card-grid { grid-template-columns: 1fr; }
}
