/* VPN Panel — Webadmin RTL overrides */

/* ── Vazirmatn only (override Montserrat / IBM Plex from theme) ── */
html,
body,
button,
input,
select,
textarea,
.btn,
.form-control,
.form-select,
.dropdown-menu,
.table,
.card,
.card-title,
.page-title,
.footer,
.alert,
.badge,
h1, h2, h3, h4, h5, h6,
.navbar-header,
#sidebar-menu ul li a,
#sidebar-menu .menu-title,
#sidebar-menu .menu-item,
.metismenu .menu-item {
    font-family: 'Vazirmatn', sans-serif !important;
}

/* Keep icon fonts intact */
.bx,
[class^="bx-"],
[class*=" bx-"],
i.bx {
    font-family: boxicons !important;
    font-weight: normal !important;
    font-style: normal !important;
}

.mdi:before,
.mdi-set,
[class^="mdi-"]:before {
    font-family: "Material Design Icons" !important;
}

/* ── RTL sidebar on the right ── */
html[dir="rtl"] .vertical-menu {
    right: 0;
    left: auto;
    border-right: none;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

html[dir="rtl"] .main-content {
    margin-right: 270px;
    margin-left: 0 !important;
}

html[dir="rtl"] .isvertical-topbar {
    right: 270px;
    left: 0 !important;
}

html[dir="rtl"] .vertical-menu .vertical-menu-btn {
    left: 0;
    right: auto;
}

/* ── Sidebar menu + icons ── */
#sidebar-menu ul li a {
    display: flex !important;
    align-items: center;
    gap: 0.65rem;
}

#sidebar-menu ul li a .nav-icon {
    flex-shrink: 0;
    width: 1.35rem;
    min-width: 1.35rem;
    font-size: 1.25rem;
    line-height: 1;
    text-align: center;
    opacity: 0.9;
}

#sidebar-menu ul li.mm-active > a .nav-icon,
#sidebar-menu ul li a:hover .nav-icon,
#sidebar-menu ul li a:active .nav-icon {
    opacity: 1;
}

#sidebar-menu .menu-title {
    padding: 12px 20px 8px;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.7;
}

#sidebar-menu ul.sub-menu {
    padding-right: 0;
}

#sidebar-menu ul.sub-menu li a {
    padding-right: 2.75rem !important;
    padding-left: 1rem !important;
    font-size: 13px;
}

#sidebar-menu ul.sub-menu li a .nav-icon {
    font-size: 1.05rem;
    min-width: 1.15rem;
    width: 1.15rem;
}

body[data-sidebar="dark"] #sidebar-menu ul li a {
    color: #a6b0cf;
}

body[data-sidebar="dark"] #sidebar-menu ul li.mm-active > a,
body[data-sidebar="dark"] #sidebar-menu ul li a:hover {
    color: #fff;
}

body[data-sidebar="dark"] #sidebar-menu ul li.mm-active > a .nav-icon {
    color: #fff;
}

/* ── Page polish ── */
/* Theme offsets fixed topbar (75px) via .main-content .content — panel uses .page-content too */
.main-content .content,
.main-content .page-content {
    margin-top: 75px;
    padding: 0 15px 10px;
}

.main-content .page-content {
    padding-top: 1rem;
}

.isvertical-topbar {
    z-index: 1005;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.vp-page-header {
    margin-bottom: 1rem;
}

.vp-page-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.vp-page-actions .btn {
    white-space: nowrap;
}

html[dir="rtl"] .card-header.d-flex {
    gap: 0.75rem;
}

html[dir="rtl"] .card-header .card-title {
    flex: 1 1 auto;
    min-width: 0;
}

.accounts-table-wrap {
    overflow-x: auto;
}

.account-actions-floating {
    display: block;
    min-width: 220px;
    text-align: right;
    direction: rtl;
    z-index: 1055;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.accounts-actions-cell {
    width: 48px;
    white-space: nowrap;
}

/* ── Mobile sidebar (admin / agent / seller / client panels) ── */
.vp-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(15, 23, 42, 0.55);
    -webkit-tap-highlight-color: transparent;
}

body.vp-sidebar-open .vp-sidebar-overlay,
body.sidebar-enable .vp-sidebar-overlay {
    display: block;
}

body.vp-sidebar-open.vp-panel-app,
body.sidebar-enable.vp-panel-app {
    overflow: hidden;
}

@media (max-width: 991.98px) {
    html[dir="rtl"] .main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    html[dir="rtl"] .isvertical-topbar {
        right: 0 !important;
        left: 0 !important;
        z-index: 1050 !important;
    }

    /* Slide-in drawer — do not use display:none (breaks theme + transforms) */
    #layout-wrapper .vertical-menu {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        right: -320px !important;
        left: auto !important;
        width: min(280px, 86vw) !important;
        max-width: 86vw;
        z-index: 1055 !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        transition: right 0.28s ease;
        box-shadow: none;
        overflow: visible !important;
    }

    body.vp-sidebar-open #layout-wrapper .vertical-menu,
    body.sidebar-enable #layout-wrapper .vertical-menu {
        right: 0 !important;
        box-shadow: -12px 0 40px rgba(15, 23, 42, 0.25);
    }

    #layout-wrapper .vertical-menu .sidebar-menu-scroll {
        height: 100vh !important;
        max-height: 100vh;
    }

    #layout-wrapper .vertical-menu .vertical-menu-btn {
        display: none !important;
    }

    .navbar-header .vertical-menu-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        z-index: 2;
    }

    .navbar-header {
        height: auto !important;
        min-height: 58px;
        padding: 0.35rem 0.5rem !important;
        flex-wrap: nowrap;
        gap: 0.25rem;
    }

    .navbar-header > .d-flex:first-child {
        min-width: 0;
        flex: 1 1 auto;
    }

    .vp-topbar-actions {
        flex-shrink: 0;
    }

    .vp-topbar-mobile-title {
        padding: 0.35rem 0.85rem 0.5rem;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        background: inherit;
    }

    .vp-topbar-mobile-title .page-title {
        font-size: 0.95rem;
        font-weight: 600;
        color: #334155;
    }

    .isvertical-topbar .header-profile-user {
        width: 32px;
        height: 32px;
    }

    .isvertical-topbar {
        height: auto;
    }

    .vp-panel-app .main-content .content,
    .vp-panel-app .main-content .page-content {
        margin-top: calc(58px + 2.35rem);
        padding: 0.5rem 0.65rem 0.75rem;
    }

    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .vp-page-header {
        flex-direction: column;
        align-items: stretch !important;
    }

    .vp-page-actions {
        width: 100%;
        justify-content: flex-start !important;
    }

    .vp-page-actions .btn {
        flex: 1 1 auto;
        min-width: 0;
    }

    .panel-page-hero {
        padding: 1rem 1.1rem;
    }

    .panel-page-hero h2 {
        font-size: 1.1rem;
    }

    .panel-page-hero .hero-actions {
        width: 100%;
    }

    .panel-page-hero .hero-actions .btn {
        flex: 1 1 auto;
    }

    .panel-dash-hero {
        padding: 1.15rem 1.2rem;
    }

    .panel-dash-hero h2 {
        font-size: 1.15rem;
    }

    .panel-dash-hero .hero-wallet {
        margin-top: 0.75rem;
        width: 100%;
    }

    .panel-modern-card .card-head {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .panel-filter-bar .row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .vp-form-actions {
        flex-direction: column;
        align-items: stretch !important;
    }

    .vp-form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .panel-export-group {
        width: 100%;
    }

    .panel-export-group .btn {
        width: 100%;
    }

    .table-responsive {
        margin-bottom: 0;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        font-size: 0.82rem;
    }

    .table .btn-sm {
        padding: 0.2rem 0.45rem;
        font-size: 0.75rem;
    }

    .card-header.d-flex {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }

    .alert.d-flex {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .alert.d-flex form,
    .alert.d-flex .btn {
        width: 100%;
    }

    .client-dash-hero {
        padding: 1.1rem 1.15rem;
    }

    .client-dash-hero .d-flex {
        flex-direction: column;
        gap: 0.75rem;
    }

    .client-quick-action {
        flex-direction: row;
        align-items: flex-start;
    }

    .server-monitor-gauges {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .sm-ring {
        --size: 64px !important;
    }

    #sidebar-menu ul.sub-menu {
        max-height: 60vh;
        overflow-y: auto;
    }
}

@media (min-width: 576px) and (max-width: 991.98px) {
    .vp-topbar-mobile-title {
        display: none !important;
    }

    .vp-panel-app .main-content .content,
    .vp-panel-app .main-content .page-content {
        margin-top: 75px;
    }
}

@media (max-width: 575.98px) {
    .navbar-brand-box .logo-lg {
        display: none !important;
    }

    .panel-action-grid .btn {
        width: 100%;
    }

    .panel-quick-action {
        padding: 0.8rem 0.85rem;
    }

    .panel-kpi-card .value {
        font-size: 1.2rem;
    }

    .col-form-label,
    .form-label {
        font-size: 0.85rem;
    }

    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .btn-group > .btn {
        width: 100%;
        border-radius: 0.375rem !important;
        margin-bottom: 0.25rem;
    }

    .dropdown-menu {
        max-width: calc(100vw - 1.5rem);
    }

    .footer .row {
        text-align: center;
    }
}

@media (max-width: 991.98px) {
    .mb-3[class*="col-"],
    .mb-4[class*="col-"],
    .g-3 > [class*="col-"],
    .g-4 > [class*="col-"] {
        margin-bottom: 0.75rem;
    }
}

/* Forms: full-width fields on small screens */
@media (max-width: 767.98px) {
    .panel-form-section .col-md-6,
    .panel-form-section .col-md-4,
    .panel-form-section .col-md-3,
    .panel-modern-card .col-md-6,
    .panel-modern-card .col-md-4,
    .panel-modern-card .col-md-3,
    form .col-md-6,
    form .col-md-4,
    form .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Charts */
@media (max-width: 767.98px) {
    .panel-chart-wrap,
    .chart-container {
        position: relative;
        height: 220px !important;
        max-height: 50vh;
    }

    canvas {
        max-width: 100% !important;
    }
}
