/* =========================================
   ZERYNX VPN — DESIGN SYSTEM
   ========================================= */

:root {
    --bg: #080e19;
    --bg-secondary: #0d1524;
    --surface: #111c2d;
    --surface-hover: #17253a;
    --border: rgba(148, 163, 184, 0.13);

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

    --primary: #00d4ff;
    --primary-soft: rgba(0, 212, 255, 0.11);
    --green: #22c58b;
    --purple: #a78bfa;
    --orange: #fb923c;

    --sidebar-width: 270px;
    --radius: 16px;

    --shadow: 0 12px 35px rgba(0, 0, 0, 0.18);
}

[data-theme="light"] {
    --bg: #f1f5f9;
    --bg-secondary: #ffffff;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --border: rgba(15, 23, 42, 0.1);

    --text: #172033;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --primary: #009fc4;
    --primary-soft: rgba(0, 159, 196, 0.1);

    --shadow: 0 12px 35px rgba(15, 23, 42, 0.05);
}

/* RESET */

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

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Vazirmatn", sans-serif;
    font-size: 15px;
    transition: background 0.25s, color 0.25s;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
}

/* =========================================
   SIDEBAR
   ========================================= */

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    padding: 25px 18px 18px;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 5px 8px 30px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}

.brand-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #00d4ff, #0879b9);
    color: #06111e;
    font-size: 27px;
    font-weight: 900;
    border-radius: 14px;
    box-shadow: 0 5px 22px rgba(0, 212, 255, 0.22);
}

.brand-info h1 {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 2px;
}

.brand-info span {
    display: block;
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: 2.5px;
    margin-top: 2px;
}

.sidebar-close,
.menu-toggle {
    display: none;
}

.sidebar-section {
    margin-bottom: 27px;
}

.section-label {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    padding: 0 12px;
    margin-bottom: 12px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 14px;
    border-radius: 11px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    transition: 0.2s ease;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-item.active {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: rgba(0, 212, 255, 0.12);
}

.nav-icon {
    width: 23px;
    text-align: center;
    font-size: 20px;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 15px 12px;
    border-radius: 13px;
    margin-bottom: 15px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 12px rgba(34, 197, 139, 0.55);
    flex-shrink: 0;
}

.connection-status strong,
.connection-status small {
    display: block;
}

.connection-status strong {
    font-size: 13px;
}

.connection-status small {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* =========================================
   MAIN CONTENT
   ========================================= */

.main-content {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    height: 82px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 38px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-right,
.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.breadcrumb strong {
    color: var(--text);
    font-size: 14px;
}

.breadcrumb-divider {
    opacity: 0.4;
}

.topbar-button {
    width: 42px;
    height: 42px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 11px;
    font-size: 13px;
    font-weight: 800;
}

.topbar-button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.theme-toggle {
    font-size: 22px;
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 17px;
    border-right: 1px solid var(--border);
}

.admin-avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 900;
}

.admin-info strong,
.admin-info small {
    display: block;
}

.admin-info strong {
    font-size: 13px;
}

.admin-info small {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 3px;
}

/* =========================================
   PAGE CONTENT
   ========================================= */

.page-content {
    padding: 38px;
    max-width: 1800px;
    margin: 0 auto;
}

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 32px;
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 13px;
}

.eyebrow-line {
    width: 25px;
    height: 2px;
    background: var(--primary);
}

.page-heading h2 {
    font-size: clamp(23px, 2.5vw, 31px);
    font-weight: 800;
    margin-bottom: 8px;
}

.page-heading p {
    color: var(--text-secondary);
    font-size: 14px;
}

.heading-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.button {
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 12px 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-size: 13px;
    font-weight: 700;
    transition: 0.2s;
    white-space: nowrap;
}

.button-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #06111e;
}

.button-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.button-secondary {
    background: var(--surface);
    color: var(--text);
}

.button-secondary:hover {
    border-color: var(--primary);
}

/* =========================================
   STAT CARDS
   ========================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 23px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    min-width: 0;
    transition: 0.25s;
    box-shadow: var(--shadow);
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(0, 212, 255, 0.3);
}

.stat-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    gap: 10px;
}

.stat-icon {
    width: 43px;
    height: 43px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.cyan {
    color: var(--primary);
    background: var(--primary-soft);
}

.stat-icon.green {
    color: var(--green);
    background: rgba(34, 197, 139, 0.1);
}

.stat-icon.purple {
    color: var(--purple);
    background: rgba(167, 139, 250, 0.1);
}

.stat-icon.orange {
    color: var(--orange);
    background: rgba(251, 146, 60, 0.1);
}

.stat-value {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -1px;
    margin: 18px 0 12px;
    direction: ltr;
    text-align: right;
}

.stat-value small {
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-footer {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 11px;
    color: var(--text-muted);
}

.stat-neutral {
    color: var(--text-muted);
    font-weight: 800;
}

/* =========================================
   PANELS
   ========================================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
    gap: 20px;
    margin-bottom: 22px;
}

.panel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    min-width: 0;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 23px;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 7px;
}

.panel-header p {
    font-size: 12px;
    color: var(--text-muted);
}

.live-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
}

.live-badge span {
    width: 7px;
    height: 7px;
    background: var(--orange);
    border-radius: 50%;
}

.traffic-placeholder {
    min-height: 245px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 11px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 25px;
}

.traffic-placeholder-icon {
    width: 55px;
    height: 55px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 30px;
}

.traffic-placeholder strong {
    font-size: 14px;
}

.traffic-placeholder > span:last-child {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 340px;
    line-height: 1.9;
}

/* SYSTEM STATUS */

.system-list {
    display: flex;
    flex-direction: column;
}

.system-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 17px 0;
    border-bottom: 1px solid var(--border);
    min-width: 0;
}

.system-item:last-child {
    border-bottom: none;
}

.system-indicator {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.system-indicator.pending {
    background: var(--orange);
}

.system-item > div {
    flex: 1;
    min-width: 0;
}

.system-item strong {
    display: block;
    font-size: 12px;
    direction: ltr;
    text-align: right;
}

.system-item small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 5px;
}

.system-label {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.pending-text {
    color: var(--orange);
}

/* =========================================
   USERS TABLE
   ========================================= */

.users-panel {
    margin-bottom: 24px;
}

.text-button {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 550px;
}

th {
    text-align: right;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    padding: 15px;
    background: var(--bg-secondary);
}

td {
    padding: 19px 15px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.empty-table {
    text-align: center;
    color: var(--text-muted);
    padding: 35px 15px;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 20px 2px;
    color: var(--text-muted);
    font-size: 11px;
}

/* =========================================
   OVERLAY
   ========================================= */

.sidebar-overlay {
    display: none;
}

/* =========================================
   RESPONSIVE — TABLET
   ========================================= */

@media (max-width: 1200px) {
    :root {
        --sidebar-width: 235px;
    }

    .page-content {
        padding: 28px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   RESPONSIVE — MOBILE
   ========================================= */

@media (max-width: 760px) {

    .sidebar {
        width: min(300px, 85vw);
        transform: translateX(110%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: grid;
        place-items: center;
        margin-right: auto;
        width: 35px;
        height: 35px;
        background: var(--surface);
        border: 1px solid var(--border);
        color: var(--text);
        border-radius: 9px;
        font-size: 23px;
    }

    .sidebar-overlay.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 90;
        backdrop-filter: blur(3px);
    }

    .main-content {
        margin-right: 0;
    }

    .topbar {
        height: 70px;
        padding: 0 17px;
    }

    .topbar-right,
    .topbar-left {
        gap: 11px;
    }

    .menu-toggle {
        display: grid;
        place-items: center;
        width: 40px;
        height: 40px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface);
        color: var(--text);
        font-size: 20px;
    }

    .breadcrumb {
        gap: 7px;
        font-size: 11px;
    }

    .breadcrumb strong {
        font-size: 12px;
    }

    .topbar-button {
        width: 37px;
        height: 37px;
    }

    .admin-profile {
        display: none;
    }

    .page-content {
        padding: 25px 17px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
        margin-bottom: 24px;
    }

    .page-heading h2 {
        font-size: 24px;
    }

    .page-heading p {
        font-size: 12px;
        line-height: 1.9;
    }

    .heading-actions {
        width: 100%;
    }

    .heading-actions .button {
        flex: 1;
        padding: 11px 9px;
        font-size: 12px;
    }

    .stats-grid {
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-top {
        font-size: 11px;
    }

    .stat-icon {
        width: 37px;
        height: 37px;
        font-size: 18px;
    }

    .stat-value {
        font-size: 29px;
        margin: 14px 0 10px;
    }

    .stat-footer {
        font-size: 10px;
        flex-wrap: wrap;
    }

    .dashboard-grid {
        gap: 15px;
    }

    .panel-card {
        padding: 18px;
    }

    .traffic-placeholder {
        min-height: 210px;
    }

    .footer {
        flex-direction: column;
        text-align: center;
        line-height: 1.8;
    }
}

/* =========================================
   SMALL MOBILE
   ========================================= */

@media (max-width: 380px) {

    .page-content {
        padding: 20px 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 18px;
    }

    .heading-actions {
        flex-direction: column;
    }

    .heading-actions .button {
        width: 100%;
    }

    .eyebrow {
        font-size: 9px;
    }

    .topbar {
        padding: 0 11px;
    }
}

/* =========================================
   LARGE SCREENS
   ========================================= */

@media (min-width: 1600px) {
    .page-content {
        padding: 45px;
    }

    .stats-grid {
        gap: 22px;
    }

    .stat-card {
        padding: 27px;
    }
}

/* =========================================
   ENGLISH DIRECTION
   ========================================= */

html[dir="ltr"] .sidebar {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 1px solid var(--border);
}

html[dir="ltr"] .main-content {
    margin-right: 0;
    margin-left: var(--sidebar-width);
}

html[dir="ltr"] .brand-info {
    text-align: left;
}

html[dir="ltr"] .sidebar-close {
    margin-right: 0;
    margin-left: auto;
}

html[dir="ltr"] .connection-status {
    direction: ltr;
}

html[dir="ltr"] .nav-item {
    direction: ltr;
}

html[dir="ltr"] .admin-profile {
    padding-right: 0;
    padding-left: 17px;
    border-right: none;
    border-left: 1px solid var(--border);
}

html[dir="ltr"] .system-item strong {
    text-align: left;
}

html[dir="ltr"] th {
    text-align: left;
}

html[dir="ltr"] .stat-value {
    text-align: left;
}

@media (max-width: 760px) {
    html[dir="ltr"] .sidebar {
        left: 0;
        right: auto;
        transform: translateX(-110%);
    }

    html[dir="ltr"] .sidebar.open {
        transform: translateX(0);
    }

    html[dir="ltr"] .main-content {
        margin-left: 0;
    }
}
