:root {
    /* =========================
       MRZ VPN COLOR SYSTEM - بهبود یافته
    ========================= */

    --bg: #F0F2F5;
    --card: #FFFFFF;

    --primary: #1A3967;
    --primary-hover: #142D52;
    --primary-light: #2A4A7A;
    --primary-dark: #0F1F3A;

    --accent: #ED7F22;
    --accent-hover: #D86F1C;
    --accent-light: #F59E4C;
    --accent-dark: #C45F10;

    --text: #1F2937;
    --text-muted: #6B7280;
    --text-light: #9CA3AF;

    --border: #E5E7EB;
    --border-light: #F3F4F6;

    /* STATUS COLORS */
    --green: #10B981;
    --green-bg: #D1FAE5;
    --green-border: #A7F3D0;

    --red: #EF4444;
    --red-bg: #FEE2E2;
    --red-border: #FCA5A5;

    --yellow: #F59E0B;
    --yellow-bg: #FEF3C7;
    --yellow-border: #FCD34D;

    --blue: #3B82F6;
    --blue-bg: #DBEAFE;
    --blue-border: #BFDBFE;

    --orange: #ED7F22;
    --orange-bg: #FFF1E6;
    --orange-border: #FDE0C4;

    /* SIDEBAR */
    --sidebar: #1A3967;
    --sidebar-text: #FFFFFF;
    --sidebar-muted: rgba(255,255,255,0.7);
    --sidebar-hover: rgba(255,255,255,0.12);
    --sidebar-active: #ED7F22;

    /* UI */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.07);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
    --shadow-xl: 0 12px 40px rgba(0,0,0,0.10);
}

/* =========================
   GLOBAL RESET & TYPOGRAPHY
========================= */
* {
    box-sizing: border-box;
    margin: 0;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    direction: rtl;
}

/* =========================
   SCROLLBAR
========================= */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--border-light);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* =========================
   PANEL LAYOUT
========================= */
.panel-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: row;
}

.panel-main {
    width: calc(100% - 260px);
    min-height: 100vh;
    margin-right: 260px;
    background: var(--bg);
    padding: 0;
}

.panel-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
}

/* =========================
   SIDEBAR
========================= */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 260px;
    height: 100vh;
    background: var(--sidebar);
    color: var(--sidebar-text);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    z-index: 3000;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 999px;
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
}

/* BRAND */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 0 4px;
}
.sidebar-brand img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}
.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.4;
}
.sidebar-brand-title {
    font-size: 18px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}
.sidebar-brand-title.latin {
    font-family: 'Tahoma', sans-serif;
}
.sidebar-brand-subtitle {
    font-size: 12px;
    color: var(--sidebar-muted);
    margin-top: 1px;
}

/* DIVIDER */
.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.10);
    margin: 10px 0;
}

/* MENU */
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 4px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    cursor: pointer;
}
.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: white;
}
.sidebar-link.active {
    background: var(--sidebar-active);
    color: white;
    box-shadow: 0 4px 12px rgba(237, 127, 34, 0.3);
}
.sidebar-icon {
    width: 26px;
    text-align: center;
    font-size: 17px;
    flex-shrink: 0;
}
.sidebar-button {
    font-family: inherit;
    text-align: right;
    width: 100%;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.8);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-button:hover {
    background: var(--sidebar-hover);
    color: white;
}
.sidebar-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #FCA5A5;
}

/* SIDEBAR SECTIONS */
.sidebar-section-title {
    font-size: 10px;
    font-weight: 600;
    opacity: 0.5;
    letter-spacing: 1.2px;
    margin: 14px 14px 8px;
    color: white;
    text-transform: uppercase;
    direction: ltr;
    text-align: left;
}

.sidebar-status-box {
    padding: 0 14px;
    direction: ltr;
    text-align: left;
}
.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 12px;
    color: rgba(255,255,255,0.75);
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.status-item:last-child {
    border-bottom: none;
}
.status-item small {
    font-weight: 500;
    font-size: 11px;
}
.status-item .status-ok {
    color: #34D399;
}
.status-item .status-bad {
    color: #F87171;
}

.sidebar-resource {
    padding: 0 14px;
    font-size: 13px;
    direction: ltr;
    text-align: left;
}
.sidebar-resource div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.75);
}
.sidebar-resource div:last-child {
    border-bottom: none;
}
.sidebar-resource strong {
    font-weight: 600;
    color: white;
    font-size: 13px;
}

.sidebar-version {
    text-align: center;
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.05);
    letter-spacing: 0.5px;
}

/* SIDEBAR BOTTOM */
.sidebar-bottom {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* =========================
   MOBILE SIDEBAR
========================= */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--sidebar);
    color: white;
    font-size: 24px;
    z-index: 4000;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}
.mobile-menu-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}
.mobile-menu-btn.hide {
    display: none !important;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2500;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.sidebar.mobile-open {
    right: 0;
}

@media (max-width: 700px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .sidebar {
        right: -280px;
        width: 280px;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .panel-main {
        width: 100%;
        margin-right: 0;
    }
    .panel-container {
        padding: 16px !important;
    }
}

/* =========================
   BUTTONS (Global)
========================= */
.btn-primary-mrz,
.btn-secondary-mrz,
.btn-danger-mrz,
.btn-success-mrz {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
}
.btn-primary-mrz {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 14px rgba(237, 127, 34, 0.3);
}
.btn-primary-mrz:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(237, 127, 34, 0.35);
}
.btn-secondary-mrz {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px rgba(26, 57, 103, 0.3);
}
.btn-secondary-mrz:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 57, 103, 0.35);
}
.btn-danger-mrz {
    background: #EF4444;
    color: white;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}
.btn-danger-mrz:hover {
    background: #DC2626;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
}
.btn-success-mrz {
    background: #10B981;
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}
.btn-success-mrz:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}
/* Small buttons */
.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: var(--radius-xs);
}

/* =========================
   CARDS (improved)
========================= */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all 0.25s ease;
}
.card:hover {
    box-shadow: var(--shadow-md);
}
.card-body {
    padding: 20px;
}

/* =========================
   STATUS BADGES (improved)
========================= */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid transparent;
}
.status-active {
    background: var(--green-bg);
    color: var(--green);
    border-color: var(--green-border);
}
.status-disabled {
    background: var(--red-bg);
    color: var(--red);
    border-color: var(--red-border);
}
.status-online {
    background: var(--green-bg);
    color: var(--green);
    border-color: var(--green-border);
}
.status-offline {
    background: var(--red-bg);
    color: var(--red);
    border-color: var(--red-border);
}
.status-exhausted {
    background: var(--yellow-bg);
    color: var(--yellow);
    border-color: var(--yellow-border);
}
.status-expired {
    background: var(--red-bg);
    color: var(--red);
    border-color: var(--red-border);
}

/* =========================
   FORM ELEMENTS
========================= */
input, select, textarea {
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    background: white;
    color: var(--text);
    transition: all 0.2s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(237, 127, 34, 0.12);
}
input::placeholder {
    color: var(--text-light);
}

/* =========================
   UTILITY
========================= */
.text-muted {
    color: var(--text-muted);
}
.text-accent {
    color: var(--accent);
}
.text-primary {
    color: var(--primary);
}
.ltr {
    direction: ltr;
    unicode-bidi: isolate;
}
.ltr-number {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
}

/* =========================
   RESPONSIVE FINE-TUNE
========================= */
@media (max-width: 576px) {
    .panel-container {
        padding: 12px !important;
    }
    .card-body {
        padding: 14px;
    }
    .btn-primary-mrz,
    .btn-secondary-mrz,
    .btn-danger-mrz,
    .btn-success-mrz {
        padding: 7px 14px;
        font-size: 12px;
    }
}