﻿* {
    font-family: Vazirmatn, sans-serif;
    font-feature-settings: "ss01";
}

html {
    font-size: 14px;
    direction: rtl;
    text-align: right;
    position: relative;
    min-height: 100%;
}


@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

body {
    margin-bottom: 60px;
}


/* Header Styles */
.navbar {
    border-bottom: 1px solid #e3e6f0;
    padding: 0.75rem 1rem;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 600;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 56px;
    bottom: 0;
    right: 0;
    z-index: 100;
    padding: 48px 0 0;
    box-shadow: 7px 0px 20px rgb(0 0 0 / 57%);
    overflow-y: auto;
    transition: all 0.3s ease;
}

    .sidebar .nav-link {
        color: #333;
        padding: 0.75rem 1rem;
        margin: 0.125rem 0.5rem;
        border-radius: 0.375rem;
        transition: all 0.2s ease;
        font-weight: 500;
    }

        .sidebar .nav-link:hover {
            background-color: #f8f9fa;
            color: #0d6efd;
        }

        .sidebar .nav-link.active {
            background-color: #0d6efd;
            color: white;
        }

        .sidebar .nav-link i {
            width: 20px;
            text-align: center;
        }

/* Main Content */
.main-content {
    margin-top: 56px;
    padding-top: 2rem;
    transition: all 0.3s ease;
}

/* Stats Cards */
.stats-card {
    border: none;
    border-radius: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

    .stats-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    }

.icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.text-xs {
    font-size: 0.75rem;
}

.font-weight-bold {
    font-weight: 600 !important;
}

.text-gray-800 {
    color: #5a5c69 !important;
}

/* Cards */
.card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e3e6f0;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem 0.5rem 0 0 !important;
}

/* Tables */
.table {
    margin-bottom: 0;
}

    .table th {
        border-top: none;
        font-weight: 600;
        color: #5a5c69;
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .table td {
        vertical-align: middle;
        padding: 0.75rem;
    }

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.025);
}

/* Badges */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
}

/* Buttons */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Status Dots */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* Charts */
.chart-area {
    position: relative;
    height: 320px;
}

.chart-pie {
    position: relative;
    height: 245px;
}

/* Page Content */
.page-content {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sidebar Desktop - Always Visible */
@media (min-width: 769px) {
    .sidebar {
        display: block !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    /* Sidebar Mobile - Hidden by default */
    .sidebar {
        position: fixed !important;
        transform: translateX(100%);
        width: 80% !important;
        max-width: 300px;
        top: 56px;
        bottom: 0;
        right: 0;
        z-index: 1050;
        transition: transform 0.3s ease;
        display: none;
    }

        .sidebar.show {
            transform: translateX(0);
            display: block !important;
        }

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

    /* Sidebar Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
    }

        .sidebar-overlay.show {
            display: block;
        }

    /* Tables Responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    /* Cards */
    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Typography */
    h1 {
        font-size: 1.5rem !important;
    }

    h2 {
        font-size: 1.3rem !important;
    }

    h3 {
        font-size: 1.1rem !important;
    }

    h4 {
        font-size: 1rem !important;
    }

    h5 {
        font-size: 0.9rem !important;
    }

    /* Buttons */
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }

    .btn-sm {
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
    }

    /* Stats Cards */
    .stats-card {
        margin-bottom: 1rem;
    }

    /* Forms */
    .form-control, .form-select {
        font-size: 0.875rem;
    }

    /* Charts */
    .chart-area {
        height: 220px !important;
    }

    .chart-pie {
        height: 200px !important;
    }

    /* Navbar */
    .navbar-brand {
        font-size: 1rem;
    }

        .navbar-brand img {
            height: 32px !important;
        }

    /* Avatar */
    .avatar-circle {
        width: 28px !important;
        height: 28px !important;
        font-size: 12px !important;
    }
}

@media (max-width: 576px) {
    .container, .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Extra small screens */
    .sidebar {
        width: 85% !important;
    }

    h1 {
        font-size: 1.25rem !important;
    }

    h2 {
        font-size: 1.1rem !important;
    }

    h3 {
        font-size: 1rem !important;
    }

    .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }

    table {
        font-size: 0.75rem;
    }

    .table th, .table td {
        padding: 0.5rem;
    }
}

/* Prevent horizontal page scroll while keeping internal scrollable containers */
html, body {
    overflow-x: hidden; /* prevent page-level horizontal scrollbar */
}

/* clip همان کار را بدون ساختن scroll container انجام می‌دهد؛ hidden باعث از کار افتادن position: sticky می‌شد */
@supports (overflow-x: clip) {
    html, body {
        overflow-x: clip;
    }
}

/* Ensure elements that intentionally scroll horizontally keep that behaviour */
.table-responsive, .chart-area, .chart-pie {
    overflow-x: auto;
}

/* Defensive: avoid elements exceeding viewport width */
img, canvas, .card, .container, .container-fluid {
    max-width: 100%;
    box-sizing: border-box;
}

/* Hide hamburger on desktop */
.hamburger-menu {
    display: none;
}

/* Footer fixes to ensure visibility over mobile overlays */
footer.footer {
    position: relative; /* allow z-index */
    z-index: 1060; /* above .sidebar (1050) and .sidebar-overlay (1040) */
    background-color: var(--bg-secondary, #222); /* ensure readable background in dark theme */
}

/* هنگام باز بودن مودال، footer نباید روی مودال (1055) و backdrop (1050) قرار بگیرد */
body.modal-open footer.footer {
    z-index: auto;
}

@media (max-width: 768px) {
    footer.footer .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* Custom Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

    .sidebar::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }

/* Modal Styles */
.modal-content {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #e3e6f0;
    padding: 1rem 1.25rem;
}

.modal-title {
    font-weight: 600;
    color: #5a5c69;
}

/* Form Styles */
.form-control, .form-select {
    border: 1px solid #d1d3e2;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

    .form-control:focus, .form-select:focus {
        border-color: #80bdff;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    }

.form-label {
    font-weight: 500;
    color: #5a5c69;
    margin-bottom: 0.5rem;
}

/* List Group */
.list-group-item {
    border: none;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e3e6f0;
}

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

/* Utilities */
.shadow-sm {
    box-shadow: 0 0.125rem 0.7rem rgb(0 0 0 / 38%) !important;
}

.shadow-sm-header {
    box-shadow: 0 -0.175rem 1rem rgb(0 0 0 / 38%) !important;
}

.border-bottom {
    border-bottom: 1px solid #e3e6f0 !important;
}

/* RTL Specific Adjustments */
[dir="rtl"] .sidebar {
    right: 0;
    left: auto;
}

[dir="rtl"] .main-content {
    margin-right: 16.66667%;
    margin-left: 0;
}

[dir="rtl"] .navbar-nav {
    margin-right: 0;
}

.modal-header .btn-close {
    margin: 0;
}

/* مخصوص فرم‌های RTL: آیکون سمت چپ */
select.form-select {
    direction: rtl; /* متن راست‌چین بمونه */
    text-align: right;
    padding-left: 2rem; /* جا برای آیکون سمت چپ */
    padding-right: .75rem; /* مثل حالت معمول */
    background-position: left .75rem center; /* آیکون سمت چپ */
    background-repeat: no-repeat;
    background-size: 16px 12px;
}
