/* ============================================
   Page Loading Overlay
   ============================================ */
#page-loading {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

    #page-loading.show {
        opacity: 1;
        visibility: visible;
    }

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #4299e1;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #2d3748;
}

    .loading-content small {
        color: #718096;
        font-size: 0.85rem;
    }

/* ---- پایه ---- */
html, body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    background-color: #f4f6f9;
}

body {
    margin: 0;
    color: #2c3e50;
}

/* ---- سایدبار ---- */
.sidebar {
    background: linear-gradient(180deg, #1e3a5f 0%, #2c5282 100%);
    min-height: 100vh;
    color: #fff;
    width: 260px;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

    .sidebar-header i {
        font-size: 1.75rem;
        color: #f6c343;
    }

    .sidebar-header .brand-text {
        font-weight: 700;
        font-size: 1.1rem;
        line-height: 1.3;
    }

    .sidebar-header .brand-sub {
        font-size: 0.75rem;
        opacity: 0.7;
    }

.nav-section {
    padding: 1rem 0;
}

.nav-section-title {
    padding: 0.5rem 1.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
    font-weight: 600;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.8) !important;
    padding: 0.75rem 1.25rem !important;
    margin: 0.15rem 0.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    transition: all 0.2s;
}

    .sidebar .nav-link:hover {
        background: rgba(255,255,255,0.1);
        color: #fff !important;
    }

    .sidebar .nav-link.active {
        background: #f6c343;
        color: #1e3a5f !important;
        font-weight: 600;
    }

    .sidebar .nav-link i {
        font-size: 1.1rem;
        width: 1.25rem;
        text-align: center;
    }

/* ---- محتوای اصلی ---- */
.main-wrapper {
    margin-right: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- هدر ---- */
.top-header {
    background: #fff;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 900;
    gap: 1rem;
}

    .top-header .page-title {
        font-weight: 600;
        color: #2d3748;
        font-size: 1.1rem;
        margin: 0;
    }

    .top-header form button.btn-outline-danger {
        border-radius: 0.5rem;
        display: flex;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.85rem;
    }

        .top-header form button.btn-outline-danger:hover {
            background: #f56565;
            color: #fff;
            border-color: #f56565;
        }

.user-dropdown .btn {
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

    .user-dropdown .btn:hover {
        background: #f7fafc;
    }

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4299e1, #2c5282);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info .user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.2;
}

.user-info .user-role {
    font-size: 0.7rem;
    color: #718096;
}

/* ---- محتوای صفحه ---- */
.page-content {
    padding: 1.5rem;
    flex: 1;
}

/* ---- کارت آمار ---- */
.stat-card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-right: 4px solid #4299e1;
    transition: transform 0.2s, box-shadow 0.2s;
}

    .stat-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }

    .stat-card .stat-label {
        font-size: 0.8rem;
        color: #718096;
        margin-bottom: 0.5rem;
    }

    .stat-card .stat-value {
        font-size: 1.75rem;
        font-weight: 700;
        color: #2d3748;
        line-height: 1;
    }

    .stat-card .stat-icon {
        font-size: 2rem;
        opacity: 0.15;
        position: absolute;
        left: 1rem;
        top: 1rem;
    }

    .stat-card.border-blue {
        border-right-color: #4299e1;
    }

    .stat-card.border-green {
        border-right-color: #48bb78;
    }

    .stat-card.border-orange {
        border-right-color: #ed8936;
    }

    .stat-card.border-red {
        border-right-color: #f56565;
    }

.persian-date-input input::placeholder {
    color: #a0aec0;
    font-size: 0.85rem;
}

/* ============================================
   Auth pages (Login, Register, Forgot Password)
   ============================================ */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    padding: 2rem 1rem;
}

.auth-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 440px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #4299e1, #2c5282);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    box-shadow: 0 8px 20px rgba(66, 153, 225, 0.3);
}

    .auth-logo i {
        font-size: 2rem;
        color: #fff;
    }

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0;
    line-height: 1.3;
}

.auth-subtitle {
    font-size: 0.85rem;
    color: #718096;
    margin: 0.35rem 0 0;
}

.auth-card .form-label {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

    .auth-card .form-label i {
        color: #4299e1;
        margin-left: 0.25rem;
    }

.auth-card .form-control-lg {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: 0.5rem;
    border: 1.5px solid #e2e8f0;
    transition: border-color 0.2s, box-shadow 0.2s;
}

    .auth-card .form-control-lg:focus {
        border-color: #4299e1;
        box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
    }

.auth-card .btn-primary {
    background: linear-gradient(135deg, #4299e1, #2c5282);
    border: none;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

    .auth-card .btn-primary:hover {
        transform: translateY(-1px);
        box-shadow: 0 8px 20px rgba(66, 153, 225, 0.4);
    }

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #edf2f7;
}

.auth-card .alert {
    border-radius: 0.5rem;
    font-size: 0.9rem;
    border: none;
}

.auth-card .alert-danger {
    background: #fff5f5;
    color: #c53030;
}

.auth-card .alert-info,
.auth-card .alert-success {
    background: #ebf8ff;
    color: #2c5282;
}

/* ---- موبایل ---- */
@media (max-width: 768px) {

    .auth-card {
        padding: 2rem 1.5rem;
        border-radius: 0.75rem;
    }

    .auth-title {
        font-size: 1.35rem;
    }

    .sidebar {
        transform: translateX(100%);
    }

        .sidebar.show {
            transform: translateX(0);
        }

    .main-wrapper {
        margin-right: 0;
    }
    /* ============================================
   Mobile sidebar toggle — nicer design
   ============================================ */
    .menu-toggle {
        display: none !important;
        width: 44px;
        height: 44px;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 0.75rem;
        color: #2d3748;
        padding: 0;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
        flex-shrink: 0;
    }

        .menu-toggle:hover {
            background: linear-gradient(135deg, #4299e1, #2c5282);
            color: #fff;
            border-color: #2c5282;
            box-shadow: 0 6px 14px rgba(66, 153, 225, 0.35);
            transform: translateY(-1px);
        }

        .menu-toggle:active {
            transform: translateY(0) scale(0.96);
            box-shadow: 0 2px 6px rgba(66, 153, 225, 0.3);
        }

        .menu-toggle i {
            font-size: 1.5rem;
            line-height: 1;
        }

    @media (max-width: 768px) {
        .menu-toggle {
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }
    }

    /* Backdrop */
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }

        .sidebar-backdrop.show {
            opacity: 1;
            visibility: visible;
        }

    .menu-toggle {
        display: inline-flex !important;
    }

    .sidebar {
        z-index: 1002 !important;
    }

        .sidebar.show {
            box-shadow: -4px 0 24px rgba(0, 0, 0, 0.35);
        }
}
