﻿html, body {
    background-color: #1e1e1e !important;
    color: #d4d4d4 !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* کارت‌ها */
.top-header {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: #2d2d30;
    border-bottom: 1px solid #3e3e42;
    position: sticky;
    top: 0;
    z-index: 1040;
}

.menu-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font-size: 24px;
    transition: .2s;
}

    .menu-btn:hover {
        background: #3e3e42;
    }

.header-title {
    flex: 1;
    text-align: center;
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: .3px;
}

.site-btn {
    color: #fff;
    border: 1px solid #555;
    border-radius: 8px;
    padding: 8px 14px;
    text-decoration: none;
    transition: .2s;
}

    .site-btn:hover {
        background: #007acc;
        border-color: #007acc;
        color: #fff;
    }

.card {
    background-color: #252526 !important;
    border: 1px solid #3e3e42 !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

.card-header {
    background-color: #2d2d30 !important;
    border-bottom: 1px solid #3e3e42 !important;
    border-radius: 12px 12px 0 0 !important;
}

/* دکمه‌ها */
.btn-primary {
    background-color: #007acc !important;
    border-color: #007acc !important;
}

    .btn-primary:hover {
        background-color: #1a8cff !important;
        border-color: #1a8cff !important;
    }

.btn-danger {
    background-color: #e51400 !important;
    border-color: #e51400 !important;
}

    .btn-danger:hover {
        background-color: #ff3300 !important;
        border-color: #ff3300 !important;
    }

.btn-secondary {
    background-color: #3e3e42 !important;
    border-color: #3e3e42 !important;
}

    .btn-secondary:hover {
        background-color: #5a5a5e !important;
    }

/* ورودی‌ها */
.form-control {
    background-color: #3c3c3c !important;
    border: 1px solid #555 !important;
    color: #d4d4d4 !important;
}

    .form-control:focus {
        background-color: #3c3c3c !important;
        border-color: #007acc !important;
        box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.3) !important;
        color: #d4d4d4 !important;
    }

/* جدول */
.table {
    color: #d4d4d4 !important;
}

    .table thead th {
        background-color: #2d2d30 !important;
        border-bottom: 2px solid #3e3e42 !important;
        color: #d4d4d4 !important;
    }

    .table tbody tr {
        border-bottom: 1px solid #3e3e42 !important;
    }

        .table tbody tr:hover {
            background-color: #2d2d30 !important;
        }

/* آلرت */
.alert-success {
    background-color: #0e3a0e !important;
    border-color: #1e5a1e !important;
    color: #6f6 !important;
}

.alert-danger {
    background-color: #3a0e0e !important;
    border-color: #5a1e1e !important;
    color: #f66 !important;
}

.alert-warning {
    background-color: #3a2e0e !important;
    border-color: #5a4e1e !important;
    color: #ffcc66 !important;
}

.alert-info {
    background-color: #0e1e3a !important;
    border-color: #1e3e5a !important;
    color: #66bbff !important;
}

/* کارت‌های آماری */
.card.bg-success {
    background-color: #0e3a0e !important;
}

.card.bg-info {
    background-color: #0e2e4a !important;
}

.card.bg-dark {
    background-color: #2d2d30 !important;
}

.card.bg-primary {
    background-color: #0e2e5a !important;
}

/* فاصله‌ها */
.gap-2 {
    gap: 0.5rem !important;
}

.gap-3 {
    gap: 1rem !important;
}

/* اسکرول */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #1e1e1e;
}

::-webkit-scrollbar-thumb {
    background: #3e3e42;
    border-radius: 5px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: #5a5a5e;
    }

/* تنظیمات کلی جدول برای دسکتاپ (اختیاری برای زیبایی بیشتر) */
.table-container {
    max-height: 500px;
    overflow-y: auto;
}

/* ==================================================== */
/* 📱 مدیا کوئری برای موبایل و تبلت (تغییر جدول به کارت) */
/* ==================================================== */
@media (max-width: 768px) {

    /* مخفی کردن هدر جدول در موبایل */
    .custom-responsive-table thead {
        display: none;
    }

    /* تبدیل ساختار جدول به بلاک */
    .custom-responsive-table,
    .custom-responsive-table tbody,
    .custom-responsive-table tr,
    .custom-responsive-table td {
        display: block;
        width: 100%;
    }

        /* استایل دادن به هر سطر به عنوان یک کارت مستقل */
        .custom-responsive-table tr {
            margin-bottom: 15px;
            background-color: #fff;
            border: 1px solid #dee2e6;
            border-radius: 8px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.05);
            overflow: hidden;
        }

        /* استایل دادن به سلول‌ها در حالت موبایل */
        .custom-responsive-table td {
            text-align: left; /* مقادیر بروند سمت چپ */
            padding: 12px 15px;
            border-bottom: 1px solid #eee;
            position: relative;
            display: flex;
            justify-content: space-between; /* فاصله بین عنوان و مقدار */
            align-items: center;
        }

            /* حذف خط زیرین برای آخرین سلول هر کارت */
            .custom-responsive-table td:last-child {
                border-bottom: none;
            }

            /* 💡 تولید عنوان ستون‌ها با استفاده از data-label */
            .custom-responsive-table td::before {
                content: attr(data-label); /* خواندن عنوان از HTML */
                font-weight: bold;
                color: #6c757d;
                text-align: right; /* عناوین بمانند سمت راست */
                flex-shrink: 0;
                margin-left: 15px;
            }
}

/* ==================================== */
/* استایل‌های لیوت اصلی (MainLayout) */
/* ==================================== */

/* جلوگیری قطعی از اسکرول افقی کل سایت */
html, body {
    overflow-x: hidden !important;
    margin: 0;
    padding: 0;
    width: 100%;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
    overflow-x: hidden;
}

/* 💡 حل مشکل کانتینرهای بوت‌استرپ که باعث اسکرول افقی می‌شدند */
.main-wrapper .container {
    max-width: 100% !important;
}

/* استایل سایدبار */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0; /* جایگزین 100vh شد تا باگ فاصله افتادن پایین صفحه حل شود */
    width: 260px;
    z-index: 1050;
    background-color: #252526;
    border-left: 1px solid #3e3e42;
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
}

.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    transition: margin-right 0.3s ease-in-out;
}

/* ==================================== */
/* ==================================== */
@media (min-width: 769px) {

    .sidebar {
        position: fixed;
        right: 0;
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-closed .sidebar {
        transform: translateX(100%);
    }

    .sidebar-open .main-wrapper {
        margin-right: 260px;
    }

    .sidebar-closed .main-wrapper {
        margin-right: 0;
    }
}

/* ==================================== */
/* 📱 رفتار موبایل (کوچکتر از 768px) */
/* ==================================== */
@media (max-width: 768px) {

    .top-header {
        padding: 0 12px;
    }

    .header-title {
        font-size: 16px;
    }

    .site-btn {
        padding: 6px 10px;
        font-size: 13px;
    }

    .sidebar {
        position: fixed !important;
        top: 0;
        right: -260px; /* مخفی در سمت راست */
        bottom: 0;
        width: 260px;
        z-index: 9999;
        transition: right 0.3s ease-in-out;
    }

    /* وقتی باز است، از راست می‌آید */
    .sidebar-open .sidebar {
        right: 0 !important;
    }

    /* محتوا نباید هیچ مارجینی بگیرد */
    .main-wrapper {
        margin-right: 0 !important;
        width: 100%;
    }
}



/* استایل دکمه‌های منو */
.nav-link {
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 5px;
    transition: 0.2s;
}

    .nav-link.active {
        background-color: #007acc !important;
        color: #fff !important;
    }

    .nav-link:hover:not(.active) {
        background-color: #3e3e42 !important;
        color: #fff !important;
        transform: translateX(-5px);
    }

/* ============================================================
   🔥 دارک کردن فیلدهای ورودی و دکمه‌ها
   ============================================================ */

/* ورودی‌ها (تیره) */
.form-control {
    background-color: #2d2d30 !important;
    border: 1px solid #3e3e42 !important;
    color: #d4d4d4 !important;
}

    .form-control::placeholder {
        color: #888888 !important;
        opacity: 1 !important;
    }

    .form-control:focus {
        background-color: #3c3c3c !important;
        border-color: #007acc !important;
        box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.3) !important;
        color: #d4d4d4 !important;
    }

/* دکمه جستجو (پرایمری) */
.btn-primary {
    background-color: #007acc !important;
    border-color: #007acc !important;
    color: #ffffff !important;
}

    .btn-primary:hover {
        background-color: #1a8cff !important;
        border-color: #1a8cff !important;
    }

    .btn-primary:disabled {
        background-color: #3a3a3e !important;
        border-color: #3a3a3e !important;
        color: #888888 !important;
    }

/* دکمه سرچ بازه‌ای (اطلاعات) */
.btn-info {
    background-color: #0e2e4a !important;
    border-color: #0e3e5a !important;
    color: #66bbff !important;
}

    .btn-info:hover {
        background-color: #1a4a6a !important;
        border-color: #1a5a7a !important;
        color: #88ccff !important;
    }

    .btn-info:disabled {
        background-color: #1a2a3a !important;
        border-color: #1a2a3a !important;
        color: #558899 !important;
    }

/* دکمه‌های عمومی (ثانویه) */
.btn-secondary {
    background-color: #3e3e42 !important;
    border-color: #3e3e42 !important;
    color: #d4d4d4 !important;
}

    .btn-secondary:hover {
        background-color: #5a5a5e !important;
        border-color: #5a5a5e !important;
    }

    .btn-secondary:disabled {
        background-color: #2a2a2e !important;
        border-color: #2a2a2e !important;
        color: #888888 !important;
    }

/* استایل لیبل‌ها */
label, .label, .form-label {
    color: #d4d4d4 !important;
}

/* ورودی‌ها (تیره) */
.form-control {
    background-color: #2d2d30 !important;
    border: 1px solid #3e3e42 !important;
    color: #ffffff !important; /* ✅ سفید کردن متن داخل ورودی */
}

    .form-control::placeholder {
        color: #aaaaaa !important; /* ✅ خاکستری روشن برای placeholder */
        opacity: 1 !important;
    }

    .form-control:focus {
        background-color: #3c3c3c !important;
        border-color: #007acc !important;
        box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.3) !important;
        color: #ffffff !important; /* ✅ سفید هنگام فوکوس */
    }

/* استایل لیبل‌ها */
label, .label, .form-label {
    color: #ffffff !important; /* ✅ سفید کردن لیبل‌ها */
}