/* ============================================
   STYLE.CSS - استایل‌های اصلی پروژه
   ============================================ */

/* ===== متغیرها ===== */
:root {
    --bg: #0b1120;
    --card: #151e2d;
    --card-hover: #1f2b3e;
    --text-main: #f0f4fc;
    --text-sec: #8ba0c4;
    --border: #2b3b52;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    --panel-bg: #0a101f;
    --color-c: #2563eb;
    --color-d: #f97316;
    --color-support: #ef4444;
    --radius: 12px;
    --transition: 0.3s ease;
}

body.light-mode {
    --bg: #f1f5f9;
    --card: #ffffff;
    --card-hover: #e2e8f0;
    --text-main: #1e293b;
    --text-sec: #475569;
    --border: #cbd5e1;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --panel-bg: #f8fafc;
    --color-c: #2563eb;
    --color-d: #ea580c;
    --color-support: #dc2626;
}

/* ===== تنظیمات پایه ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    background-color: var(--bg);
    color: var(--text-main);
    padding: 20px;
    min-height: 100vh;
    direction: rtl;
    transition: all var(--transition);
}

/* ===== فونت وزیرمتن (محلی) ===== */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ===== هدر ===== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
    transition: border-color var(--transition);
}

.header-title h1 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--text-main);
    transition: color var(--transition);
}
.header-title h1 span {
    color: #10b981;
}
.header-title p {
    color: var(--text-sec);
    margin-top: 5px;
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.theme-toggle {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.theme-toggle:hover {
    background: var(--card-hover);
}

/* ===== پیام‌های فلش ===== */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin-bottom: 15px;
    text-align: right;
    font-size: 0.95rem;
}
.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* ===== دکمه‌های عمومی ===== */
.btn-download-excel {
    background: #10b981;
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--radius);
    text-decoration: none;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition);
    display: inline-block;
    border: none;
    cursor: pointer;
}
.btn-download-excel:hover {
    background: #059669;
    transform: translateY(-2px);
}

.btn-view-reports {
    background: #3b82f6;
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--radius);
    text-decoration: none;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition);
    display: inline-block;
    border: none;
    cursor: pointer;
}
.btn-view-reports:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

.btn-filter {
    background: #3b82f6;
    color: #fff;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}
.btn-filter:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

/* ===== کارت‌های KPI ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--card);
    padding: 20px;
    border-radius: 16px;
    border-left: 4px solid #3b82f6;
    transition: all var(--transition);
    box-shadow: var(--shadow);
}
.kpi-card:hover {
    background: var(--card-hover);
    transform: translateY(-3px);
}
.kpi-card p {
    margin: 0;
    color: var(--text-sec);
    font-size: 0.9rem;
}
.kpi-card h2 {
    margin: 10px 0;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-main);
}
.kpi-card .subtext {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* ===== نمودارها ===== */
.charts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.charts-header h3 {
    color: var(--text-sec);
    font-weight: normal;
}

.reset-btn {
    background: #3b82f6;
    border: none;
    color: #fff;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}
.reset-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.5);
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card {
    background: var(--card);
    border-radius: 16px;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    height: 320px;
    box-shadow: var(--shadow);
    transition: all var(--transition);
}
.chart-card h4 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: var(--text-sec);
    display: flex;
    align-items: center;
    gap: 10px;
}
.chart-card h4 span {
    font-size: 0.8rem;
    color: #f59e0b;
}
.chart-card:nth-child(3) {
    height: 380px;
}
.chart-wrapper {
    flex-grow: 1;
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ===== پنل فعالیت‌ها ===== */
#activity-panel {
    display: none;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    transition: all var(--transition);
}
#activity-panel h4 {
    color: #f59e0b;
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}
#activity-panel ul.main-list {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
}
#activity-panel ul.main-list li {
    background: var(--panel-bg);
    padding: 15px;
    border-radius: 8px;
    border-right: 3px solid #3b82f6;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: all var(--transition);
}
#activity-panel ul.main-list li strong {
    color: #f59e0b;
    display: block;
    margin-bottom: 8px;
}
#activity-panel ul.sub-list {
    list-style-type: disc;
    padding-right: 20px;
    margin-top: 5px;
    margin-bottom: 0;
}
#activity-panel ul.sub-list li {
    background: transparent !important;
    border-right: none !important;
    padding: 4px 0;
    font-size: 0.9rem;
    border: none;
    box-shadow: none;
}
#activity-panel ul.sub-list li:hover {
    transform: none;
}

/* ===== نقشه حرارتی ===== */
.heatmap-container {
    background: var(--card);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    transition: all var(--transition);
}

/* هدر نقشه حرارتی */
.heatmap-header {
    padding: 0 4px;
    margin-bottom: 8px;
}
.heatmap-header .header-row {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 4px;
}
.heatmap-header .header-col {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: var(--text-sec);
    font-size: 1rem;
    min-height: 35px;
    background: var(--panel-bg);
    border-radius: 4px;
    border: 1px solid var(--border);
    padding: 4px 0;
}

/* بدنه نقشه حرارتی */
.building-view {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 auto;
    max-width: 1000px;
}

.floor-row {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 4px;
    padding: 0 4px;
}

.tower-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.tower-cell {
    width: 100%;
    min-height: 65px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-weight: bold;
    transition: all 0.2s ease;
    position: relative;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.tower-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--cell-color);
    opacity: 0.65;
    border-radius: 4px;
    pointer-events: none;
    transition: all var(--transition);
}
.tower-cell.inactive {
    filter: brightness(0.2) contrast(0.8);
}
.tower-cell.inactive::before {
    opacity: 0.85;
    background-color: #000;
}
.tower-cell span {
    position: relative;
    z-index: 2;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}
.tower-cell:hover {
    transform: translateY(-2px) scale(1.03);
    border: 1px solid #fff;
    z-index: 5;
}

.floor-label-center {
    flex: 0 0 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: var(--text-sec);
    font-size: 0.85rem;
}

.details-row {
    display: none;
    background: var(--panel-bg);
    border-radius: 6px;
    margin-top: 2px;
    padding: 10px 15px;
    border: 1px dashed var(--border);
    width: 100%;
    box-sizing: border-box;
    transition: all var(--transition);
}
.details-row strong {
    color: #f59e0b;
    display: block;
    margin-bottom: 5px;
}
.details-row ul {
    margin: 5px 0 5px 20px;
    padding: 0;
    color: var(--text-main);
    font-size: 0.85rem;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    font-size: 0.8rem;
    color: var(--text-sec);
    transition: color var(--transition);
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

/* ===== فرم‌ها ===== */
.form-container {
    background: var(--card);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.form-group {
    text-align: right;
}
.form-group label {
    display: block;
    color: var(--text-sec);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.submit-btn {
    background: #10b981;
    color: #fff;
    padding: 10px 30px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}
.submit-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

/* ===== جدول‌ها ===== */
.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.excel-table th {
    background: var(--panel-bg);
    color: var(--text-sec);
    padding: 8px 10px;
    border: 1px solid var(--border);
    text-align: center;
    white-space: nowrap;
}
.excel-table td {
    padding: 4px;
    border: 1px solid var(--border);
    vertical-align: middle;
}
.excel-table .form-control {
    width: 100%;
    padding: 6px 8px;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.9rem;
    min-width: 80px;
}
.excel-table .form-control:focus {
    outline: none;
    background: var(--card-hover);
}

.btn-add-row {
    background: #3b82f6;
    color: #fff;
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}
.btn-add-row:hover {
    background: #2563eb;
    transform: translateY(-2px);
}
.btn-add-row:active {
    transform: scale(0.97);
}

/* ===== دکمه‌های عملیات سریع ===== */
.quick-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* ===== فیلتر تاریخ کاربر عادی ===== */
.user-date-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 15px;
}
.user-date-item {
    flex: 0 1 180px;
    min-width: 120px;
}
.user-date-item label {
    color: var(--text-sec);
    font-size: 0.8rem;
    display: block;
    margin-bottom: 2px;
}
.user-date-item .form-control {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.9rem;
}
.user-date-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.user-date-info {
    flex: 1;
    text-align: left;
    color: var(--text-sec);
    font-size: 0.85rem;
    min-width: 80px;
}

.btn-load-date {
    background: #3b82f6;
    color: #fff;
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-load-date:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

.btn-today {
    background: #10b981;
    color: #fff;
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-today:hover {
    background: #059669;
    transform: translateY(-2px);
}

/* ===== فیلتر تاریخ ادمین ===== */
.filter-container {
    background: var(--card);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border-right: 4px solid #3b82f6;
}
.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
}
.filter-item {
    flex: 1 1 140px;
    min-width: 100px;
}
.filter-item label {
    color: var(--text-sec);
    font-size: 0.8rem;
    display: block;
    margin-bottom: 2px;
}
.filter-item .form-control {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.85rem;
}
.filter-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    flex: 0 1 auto;
}
.filter-info {
    flex: 1 1 auto;
    text-align: left;
    color: var(--text-sec);
    font-size: 0.8rem;
    min-width: 80px;
}

.btn-reset-filter {
    background: #6b7280;
    color: #fff;
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-reset-filter:hover {
    background: #4b5563;
    transform: translateY(-2px);
}

/* ===== دکمه ذخیره همه ===== */
.btn-save-all {
    background: #10b981;
    color: #fff;
    padding: 8px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-save-all:hover {
    background: #059669;
    transform: translateY(-2px);
}
.btn-save-all:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== هایلایت خطای ردیف ===== */
.activity-row.error-row {
    border: 2px solid #ef4444 !important;
    border-radius: 4px;
    background-color: rgba(239, 68, 68, 0.05);
}

/* ===== استایل پیام‌های چت با مارک‌داون ===== */
#chatMessages div strong {
    color: #f59e0b;
    font-weight: 700;
}
#chatMessages div em {
    color: #60a5fa;
    font-style: italic;
}
#chatMessages div br {
    display: block;
    content: "";
    margin: 4px 0;
}
#chatMessages div ul,
#chatMessages div ol {
    margin: 4px 0 4px 20px;
    padding: 0;
}
#chatMessages div li {
    margin: 2px 0;
    list-style-type: disc;
}

/* ===== صفحه لاگین ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    padding: 16px;
}
.login-card {
    background: var(--card);
    padding: 30px 24px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-card h2 {
    margin-bottom: 20px;
    color: var(--text-main);
}
.login-btn {
    width: 100%;
    padding: 12px;
    background: #3b82f6;
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-size: 1.1rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}
.login-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

/* ===== استایل‌های datepicker شمسی ===== */
.persian-datepicker .datepicker-plot-area {
    background-color: var(--card) !important;
    border-color: var(--border) !important;
    color: var(--text-main) !important;
    border-radius: 8px !important;
}
.persian-datepicker .datepicker-plot-area .datepicker-time-view .time-segment {
    color: var(--text-main) !important;
}
.persian-datepicker .datepicker-plot-area .datepicker-header .datepicker-header-title {
    color: var(--text-main) !important;
}
.persian-datepicker .datepicker-plot-area .datepicker-header .next-btn,
.persian-datepicker .datepicker-plot-area .datepicker-header .prev-btn {
    color: var(--text-sec) !important;
}
.persian-datepicker .datepicker-plot-area .datepicker-day-view .table-condensed td {
    color: var(--text-main) !important;
}
.persian-datepicker .datepicker-plot-area .datepicker-day-view .table-condensed td.today {
    background-color: #3b82f6 !important;
    color: #fff !important;
}
.persian-datepicker .datepicker-plot-area .datepicker-day-view .table-condensed td.selected {
    background-color: #10b981 !important;
    color: #fff !important;
}
.persian-datepicker .datepicker-plot-area .datepicker-day-view .table-condensed td:hover {
    background-color: var(--card-hover) !important;
}

/* =============================================
   ریسپانسیو (Media Queries)
   ============================================= */

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr 1fr;
    }
    .charts-grid .chart-card:last-child {
        grid-column: span 2;
        height: 340px;
    }
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        padding: 16px;
    }

    header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        padding-bottom: 12px;
        margin-bottom: 20px;
    }
    .header-title h1 {
        font-size: 1.4rem;
    }
    .header-actions {
        justify-content: center;
        margin-top: 6px;
    }
    .theme-toggle {
        font-size: 1rem;
        padding: 6px 12px;
    }

    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .kpi-card {
        padding: 14px;
    }
    .kpi-card h2 {
        font-size: 1.8rem;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
    .charts-grid .chart-card:last-child {
        grid-column: span 1;
        height: 320px;
    }
    .chart-card {
        height: 260px !important;
    }
    .chart-card:nth-child(3) {
        height: 300px !important;
    }

    .heatmap-header .header-col {
        font-size: 0.8rem;
        min-height: 28px;
    }
    .floor-label-center {
        flex: 0 0 40px;
        font-size: 0.7rem;
    }
    .tower-cell {
        min-height: 40px;
    }
    .tower-cell span {
        font-size: 0.7rem;
    }

    .form-container {
        padding: 16px;
    }

    .excel-table,
    .activity-table {
        font-size: 0.8rem;
    }
    .excel-table th,
    .excel-table td,
    .activity-table th,
    .activity-table td {
        padding: 4px 6px;
        white-space: nowrap;
    }
    .excel-table .form-control {
        font-size: 0.8rem;
        min-width: 40px;
    }

    .btn-add-row {
        font-size: 0.85rem;
        padding: 6px 14px;
    }

    .filter-item {
        flex: 1 1 calc(50% - 6px);
        min-width: 80px;
    }
    .filter-item label {
        font-size: 0.65rem !important;
    }
    .filter-item .form-control {
        font-size: 0.7rem !important;
        padding: 4px 6px !important;
        min-height: 28px;
    }
    .btn-filter,
    .btn-reset-filter {
        font-size: 0.65rem !important;
        padding: 4px 10px !important;
        min-height: 28px;
    }
    .filter-info {
        font-size: 0.6rem !important;
        min-width: 60px;
    }

    #activity-panel ul.main-list {
        grid-template-columns: 1fr;
    }

    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -8px;
        padding: 0 8px;
    }
    .excel-table,
    .activity-table,
    .reports-table {
        min-width: 600px;
    }

    .login-card {
        padding: 24px 18px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    /* ---- کارت‌های KPI در یک ردیف ---- */
    .kpi-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px !important;
    }
    .kpi-card {
        padding: 8px 4px !important;
        border-left-width: 2px !important;
        border-radius: 8px !important;
    }
    .kpi-card p {
        font-size: 0.5rem !important;
        margin-bottom: 2px !important;
    }
    .kpi-card h2 {
        font-size: 0.9rem !important;
        margin: 2px 0 !important;
    }
    .kpi-card .subtext {
        font-size: 0.45rem !important;
    }

    /* ---- نمودارها ---- */
    .charts-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .reset-btn {
        width: 100%;
    }
    .chart-card {
        height: 200px !important;
        padding: 8px 10px;
    }
    .chart-card:nth-child(3) {
        height: 220px !important;
    }
    .chart-card h4 {
        font-size: 0.8rem;
    }

    /* ---- نقشه حرارتی ---- */
    .heatmap-header .header-col {
        font-size: 0.65rem;
        min-height: 22px;
    }
    .floor-label-center {
        flex: 0 0 30px;
        font-size: 0.55rem;
    }
    .tower-cell {
        min-height: 24px;
    }
    .tower-cell span {
        font-size: 0.5rem;
    }
    .details-row {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    .details-row strong {
        font-size: 0.75rem;
    }
    .details-row ul {
        font-size: 0.7rem;
    }

    /* ---- اصلاح جدول کاربر عادی در موبایل ---- */
    .excel-table {
        width: 100% !important;
        table-layout: auto !important;
        font-size: 0.7rem !important;
        min-width: 0 !important;
    }
    .excel-table th,
    .excel-table td {
        padding: 4px 5px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        text-align: center !important;
    }

    .excel-table th:nth-child(1),
    .excel-table td:nth-child(1) {
        width: 8% !important;
        min-width: 25px !important;
        max-width: 35px !important;
    }
    .excel-table th:nth-child(2),
    .excel-table td:nth-child(2) {
        width: 12% !important;
        min-width: 35px !important;
        max-width: 50px !important;
    }
    .excel-table th:nth-child(3),
    .excel-table td:nth-child(3) {
        width: 18% !important;
        min-width: 45px !important;
        max-width: 65px !important;
    }
    .excel-table th:nth-child(4),
    .excel-table td:nth-child(4) {
        width: 25% !important;
        min-width: 65px !important;
        max-width: 100px !important;
    }
    .excel-table th:nth-child(5),
    .excel-table td:nth-child(5) {
        width: 12% !important;
        min-width: 35px !important;
        max-width: 50px !important;
    }
    .excel-table th:nth-child(6),
    .excel-table td:nth-child(6) {
        width: 10% !important;
        min-width: 28px !important;
        max-width: 40px !important;
    }
    .excel-table th:nth-child(7),
    .excel-table td:nth-child(7) {
        width: 15% !important;
        min-width: 45px !important;
        max-width: 60px !important;
    }

    .excel-table .form-control {
        font-size: 0.65rem !important;
        padding: 2px 4px !important;
        min-width: 20px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .excel-table select.form-control {
        font-size: 0.6rem !important;
        padding: 2px 4px !important;
        min-width: 20px !important;
    }
    .excel-table input.form-control {
        font-size: 0.6rem !important;
        padding: 2px 4px !important;
        min-width: 20px !important;
        width: 100% !important;
    }

    .btn-edit,
    .btn-delete,
    .btn-save,
    .btn-cancel {
        font-size: 0.75rem !important;
        padding: 2px 4px !important;
        margin: 0 1px !important;
    }

    .quick-actions {
        flex-direction: column;
    }
    .quick-actions .btn-download-excel,
    .quick-actions .btn-view-reports {
        width: 100%;
        text-align: center;
        padding: 8px;
    }

    .filter-item {
        flex: 1 1 100%;
        min-width: 60px;
    }
    .filter-actions {
        flex: 1 1 100%;
        justify-content: center;
        margin-top: 4px;
    }
    .filter-info {
        flex: 1 1 100%;
        text-align: center;
        margin-top: 4px;
    }

    .user-date-item {
        flex: 1 1 100%;
    }
    .user-date-actions {
        flex: 1 1 100%;
        justify-content: center;
    }
    .user-date-info {
        flex: 1 1 100%;
        text-align: center;
        margin-top: 4px;
    }

    .login-card {
        padding: 20px 16px;
    }
    .login-card h2 {
        font-size: 1.4rem;
    }
    .form-group input {
        font-size: 0.95rem;
        padding: 8px 12px;
    }
}

/* ===== موبایل‌های بسیار کوچک (حداکثر 400px) ===== */
@media (max-width: 400px) {
    .excel-table {
        font-size: 0.6rem !important;
    }
    .excel-table th,
    .excel-table td {
        padding: 3px 4px !important;
    }

    .excel-table th:nth-child(1),
    .excel-table td:nth-child(1) {
        width: 7% !important;
        min-width: 20px !important;
        max-width: 28px !important;
    }
    .excel-table th:nth-child(2),
    .excel-table td:nth-child(2) {
        width: 12% !important;
        min-width: 30px !important;
        max-width: 42px !important;
    }
    .excel-table th:nth-child(3),
    .excel-table td:nth-child(3) {
        width: 18% !important;
        min-width: 38px !important;
        max-width: 55px !important;
    }
    .excel-table th:nth-child(4),
    .excel-table td:nth-child(4) {
        width: 24% !important;
        min-width: 55px !important;
        max-width: 80px !important;
    }
    .excel-table th:nth-child(5),
    .excel-table td:nth-child(5) {
        width: 11% !important;
        min-width: 30px !important;
        max-width: 40px !important;
    }
    .excel-table th:nth-child(6),
    .excel-table td:nth-child(6) {
        width: 9% !important;
        min-width: 22px !important;
        max-width: 32px !important;
    }
    .excel-table th:nth-child(7),
    .excel-table td:nth-child(7) {
        width: 15% !important;
        min-width: 40px !important;
        max-width: 55px !important;
    }

    .excel-table .form-control {
        font-size: 0.55rem !important;
        padding: 1px 3px !important;
        min-width: 15px !important;
    }
    .excel-table select.form-control {
        font-size: 0.5rem !important;
    }
    .excel-table input.form-control {
        font-size: 0.5rem !important;
    }

    .btn-edit,
    .btn-delete,
    .btn-save,
    .btn-cancel {
        font-size: 0.65rem !important;
        padding: 1px 3px !important;
    }
}

/* ===== جلوگیری از اسکرول افقی در موبایل ===== */
@media (max-width: 768px) {
    body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    .table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .excel-table {
        min-width: 100% !important;
    }
}