:root {
    --primary: #2563eb;
    --secondary: #7c3aed;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.95);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    direction: rtl;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

.card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.auth-section .card {
    width: 100%;
    max-width: 450px;
}

.auth-section h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    margin-top: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    width: auto;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-export {
    background: #17a2b8;
    color: white;
}

.btn-export:hover {
    background: #138496;
}

.message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.user-info {
    background: white;
    padding: 15px 25px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.user-info span {
    color: #333;
    font-weight: 600;
}

.controls {
    margin-bottom: 20px;
}

.controls h3 {
    color: #667eea;
    margin-bottom: 20px;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    align-items: end;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 3em;
}

.stat-content {
    flex: 1;
}

.stat-label {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2.2em;
    font-weight: bold;
    color: var(--primary);
}

.stat-date {
    font-size: 0.9em;
    color: #666;
    margin-top: 2px;
}

.stat-value.small {
    font-size: 1em;
}

/* =========================
   In-page Analysis Panel
   ========================= */

.analysis-panel-summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--dark);
    list-style: none;
}

/* keep native marker hidden; we control appearance via summary text */
details > summary.analysis-panel-summary::-webkit-details-marker {
    display: none;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.analysis-field {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.85);
}

.analysis-field > summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--dark);
}

.analysis-field-body {
    margin-top: 10px;
    color: #374151;
    line-height: 1.9;
}

.analysis-kv {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px 14px;
}

/* ==========================================
   Side drawer (hamburger menu) - analysis page
   ========================================== */

.hamburger-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1200;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 0;
    cursor: pointer;
    background: var(--card-bg);
    color: var(--dark);
    box-shadow: var(--shadow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1190;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.analysis-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(360px, 88vw);
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-lg);
    z-index: 1201;
    transform: translateX(110%);
    transition: transform 220ms ease;
    padding: 16px;
    overflow: auto;
}

/* Drawer icon menu (accordion) */
.drawer-icon-menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0 14px;
}

.drawer-icon-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.drawer-icon-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.18);
}

.drawer-icon-btn.active {
    background: rgba(255, 255, 255, 0.28);
}

.drawer-icon {
    font-size: 20px;
    line-height: 1;
}

.drawer-label {
    font-weight: 700;
    font-size: 14px;
}

.drawer-section-panel {
    display: none;
}

.drawer-section-panel.active {
    display: block;
}

.drawer-section-title {
    font-weight: 800;
    margin-bottom: 12px;
}

.drawer-divider {
    border: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.18);
    margin: 16px 0;
}

/* Quick presets */
.quick-presets {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.quick-presets .btn {
    width: 100%;
    margin-top: 0;
}

.analysis-drawer.open {
    transform: translateX(0);
}

.analysis-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.drawer-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.analysis-drawer-title {
    font-weight: 800;
    color: var(--dark);
}

.analysis-drawer-close {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 0;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.06);
    color: var(--dark);
    font-size: 18px;
}

/* Quick settings modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
    display: grid;
    place-items: center;
    padding: 18px;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.quick-modal {
    width: min(760px, 96vw);
    max-height: 90vh;
    overflow: auto;
}

.quick-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 12px;
}

.modal-actions .btn {
    width: auto;
    margin-top: 0;
}

.analysis-drawer a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--dark);
    font-weight: 650;
    margin: 6px 0;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.analysis-drawer a:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.analysis-drawer small {
    color: rgba(30, 41, 59, 0.7);
    font-weight: 600;
}

.analysis-section-title {
    margin-top: 30px;
    margin-bottom: 12px;
    color: #444;
}

.mini-table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 12px;
}

.mini-table th,
.mini-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    text-align: right;
}

.mini-table th {
    background: rgba(0, 0, 0, 0.04);
    color: var(--dark);
}

/* تم‌های برنامه */
body.theme-dark {
    background: #050505;
    color: #eee;
}

body.theme-dark .card, 
body.theme-dark .user-info,
body.theme-dark .stat-card {
    background: #1a1a1a;
    color: #eee;
    box-shadow: 0 10px 40px rgba(0,0,0,1);
    border: 1px solid #333;
}

body.theme-dark .error-row {
    background-color: #450a0a !important;
    color: #fecaca !important;
}

body.theme-dark .error-row:hover {
    background-color: #7f1d1d !important;
}

.error-row {
    background-color: #ffe6e6;
}

body.theme-dark .form-group label,
body.theme-dark .stat-label,
body.theme-dark .stat-date {
    color: #999;
}

body.theme-dark .form-group input,
body.theme-dark select {
    background: #1a1a1a;
    border-color: #333;
    color: #fff;
}

body.theme-dark .btn-primary {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

body.theme-dark .btn-success {
    background: #065f46;
}

body.theme-dark .btn-export {
    background: #0e7490;
}

body.theme-dark .btn-info {
    background: #0369a1;
    color: #fff;
    border: none;
}

body.theme-dark .btn-info:hover {
    background: #075985;
}

body.theme-dark .btn-secondary {
    background: #262626;
    color: #d1d5db;
    border: 1px solid #333;
}

body.theme-dark .btn-secondary:hover {
    background: #333;
}

body.theme-dark .message.success {
    background: #064e3b;
    color: #a7f3d0;
    border-color: #065f46;
}

body.theme-dark .message.error {
    background: #450a0a;
    color: #fecaca;
    border-color: #7f1d1d;
}

body.theme-dark thead {
    background: linear-gradient(135deg, #1e1b4b 0%, #2e1065 100%);
}

body.theme-dark tbody tr {
    border-bottom-color: #222;
}

body.theme-dark tbody tr:hover {
    background: #1a1a1a;
}

body.theme-dark .stat-value {
    color: #3b82f6;
}

body.theme-dark .persian-date-input {
    background: #1a1a1a;
    border-color: #333;
    color: #fff;
}

body.theme-dark .persian-calendar {
    background: #161616;
    color: #eee;
    box-shadow: 0 20px 60px rgba(0,0,0,1);
    border: 1px solid #2a2a2a;
}

body.theme-dark .calendar-header {
    border-bottom-color: #333;
}

body.theme-dark .calendar-header button,
body.theme-dark .month-year-selector span {
    color: #eee;
}

body.theme-dark .nav-btn {
    background: #1a1a1a;
    border-color: #333;
    color: #eee;
}

body.theme-dark .nav-btn:hover {
    background: #4338ca;
    border-color: #4338ca;
}

body.theme-dark .calendar-day:not(.empty) {
    color: #eee;
}

body.theme-dark .calendar-day:not(.empty):hover {
    background: #4338ca;
}

body.theme-dark .calendar-footer {
    border-top-color: #333;
}

body.theme-dark .time-picker {
    background: #1a1a1a;
}

body.theme-dark .time-picker label {
    color: #eee;
}

body.theme-dark .time-picker input[type="number"] {
    background: #121212;
    border-color: #333;
    color: #fff;
}

body.theme-dark .time-nav {
    background: #262626;
    color: #eee;
}

body.theme-dark .time-nav:hover {
    background: #333;
}

body.theme-dark .checkbox-item {
    background: #1a1a1a;
    border-color: #333;
    color: #eee;
}

body.theme-dark .checkbox-item:hover {
    background: #262626;
    border-color: #4338ca;
}

body.theme-blue {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

body.theme-blue .btn-primary,
body.theme-blue thead {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
}

body.theme-green {
    background: linear-gradient(135deg, #064e3b 0%, #10b981 100%);
}

body.theme-green .btn-primary,
body.theme-green thead {
    background: linear-gradient(135deg, #065f46 0%, #10b981 100%);
}

.theme-selector {
    background: white;
    padding: 10px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

body.theme-dark .theme-selector {
    background: #121212;
    border: 1px solid #333;
}

.theme-selector select {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.chart-container {
    margin-bottom: 20px;
}
.setpoint-info {
    font-size: 0.9rem;
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(217, 119, 6, 0.1);
    color: #d97706;
    border: 1px solid rgba(217, 119, 6, 0.2);
    font-weight: bold;
}

body.theme-dark .setpoint-info {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.2);
}

.chart-header h3 {
    color: #4338ca;
}

body.theme-dark .chart-header h3 {
    color: #818cf8;
}

/* استایل‌های جدید برای دریافت خودکار */
.countdown-badge {
    background: #e0e7ff;
    color: #4338ca;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    border: 1px solid #c7d2fe;
}

body.theme-dark .countdown-badge {
    background: #1e1b4b;
    color: #818cf8;
    border-color: #312e81;
}

.small-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(67, 56, 202, 0.1);
    border-top: 2px solid #4338ca;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

body.theme-dark .small-spinner {
    border-color: rgba(129, 140, 248, 0.1);
    border-top-color: #818cf8;
}

.error-text {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 4px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.chart-container h3 {
    color: #667eea;
    margin-bottom: 20px;
}

/* ============================================
   New Analysis Panel Styles
   ============================================ */
.analysis-panel-new {
    padding: 25px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    margin-top: 30px;
    border: 1px solid rgba(0,0,0,0.05);
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f5f9;
}

.analysis-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.analysis-title .icon {
    font-size: 1.8em;
}

.analysis-title h2 {
    margin: 0;
    font-size: 1.5em;
    color: var(--dark);
}

.analysis-main-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.analysis-card {
    background: #f8fafc;
    border-radius: 15px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.analysis-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.analysis-card .card-header {
    font-weight: 700;
    color: #475569;
    margin-bottom: 15px;
    font-size: 0.95em;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    background: white;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #edf2f7;
}

.stat-item .label {
    font-size: 0.8em;
    color: #64748b;
    margin-bottom: 4px;
}

.stat-item .value {
    font-size: 1.3em;
    font-weight: 800;
    color: var(--primary);
}

.stat-item .value small {
    font-size: 0.6em;
    margin-right: 3px;
    color: #94a3b8;
}

.stat-item .sub-label {
    font-size: 0.75em;
    color: #94a3b8;
    margin-top: 4px;
}

/* Quality Score Circle */
.quality-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.quality-score-container {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.quality-score-circle {
    width: 80px;
    height: 80px;
}

.circular-chart {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 100%;
}

.circle-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 3.8;
}

.circle {
    fill: none;
    stroke-width: 3.8;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease;
}

#qualityScoreCircle {
    stroke: var(--success);
}

.percentage {
    fill: #1e293b;
    font-family: inherit;
    font-size: 0.5em;
    text-anchor: middle;
    font-weight: 800;
}

.quality-labels .q-label {
    font-size: 0.85em;
    color: #64748b;
}

.quality-labels .q-status {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--success);
}

.metrics-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    padding: 6px 0;
    border-bottom: 1px dashed #e2e8f0;
}

.metric-row .bold {
    font-weight: 700;
    color: #334155;
}

/* Hatch Progress */
.hatch-progress-container {
    margin-bottom: 20px;
}

.hatch-progress-bar {
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 5px;
    transition: width 1s ease;
}

.hatch-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75em;
    color: #64748b;
}

.hatch-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9em;
}

.detail-item .label {
    color: #64748b;
}

.detail-item .value {
    font-weight: 700;
    color: #1e293b;
}

/* Energy Card */
.energy-main-value {
    font-size: 2.2em;
    font-weight: 900;
    color: var(--dark);
    text-align: center;
}

.energy-main-value small {
    font-size: 0.4em;
    color: #94a3b8;
}

.energy-sub {
    text-align: center;
    font-size: 0.8em;
    color: #64748b;
    margin-bottom: 20px;
}

.energy-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.breakdown-item {
    display: grid;
    grid-template-columns: 60px 1fr 60px;
    align-items: center;
    gap: 10px;
    font-size: 0.85em;
}

.b-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
}

.b-fill {
    height: 100%;
    border-radius: 3px;
}

.b-fill.heater { background: var(--danger); }
.b-fill.mister { background: var(--primary); }

.energy-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
    text-align: center;
    font-size: 0.85em;
    color: #475569;
}

/* Advice Section */
.advice-section {
    background: #fffbeb;
    border-color: #fde68a;
}

.advice-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 20px;
}

.advice-box h4 {
    font-size: 0.95em;
    margin-bottom: 12px;
    color: #92400e;
}

.advice-metrics {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.adv-metric {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
}

.recommendation-box {
    background: #fef3c7;
    padding: 12px;
    border-radius: 8px;
    border-right: 4px solid #f59e0b;
    font-size: 0.9em;
}

.advice-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.advice-item {
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9em;
    border-right: 4px solid var(--primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.advice-item.warning { border-right-color: var(--warning); }
.advice-item.danger { border-right-color: var(--danger); }
.advice-item.success { border-right-color: var(--success); }

/* Advanced Analysis */
.advanced-analysis {
    margin-top: 20px;
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
    width: 100%;
    display: block;
}

.advanced-analysis[open] {
    padding-bottom: 15px;
}

.advanced-analysis summary {
    cursor: pointer;
    font-size: 0.95em;
    color: #64748b;
    font-weight: 600;
    padding: 10px;
    background: #f1f5f9;
    border-radius: 8px;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.advanced-analysis summary:hover {
    background: #e2e8f0;
}

.advanced-analysis summary::-webkit-details-marker {
    display: none;
}

.advanced-analysis summary::before {
    content: '▶';
    font-size: 0.8em;
    transition: transform 0.2s;
}

.advanced-analysis[open] summary::before {
    transform: rotate(90deg);
}

.advanced-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.advanced-item {
    background: white;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.chart-wrapper-small {
    position: relative;
    height: 180px;
    width: 100%;
}

.code-preview {
    background: #1e293b;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 10px;
    font-size: 0.8em;
    max-height: 200px;
    overflow: auto;
}

@media (max-width: 768px) {
    .analysis-main-grid, .advice-grid, .advanced-grid {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================
   End New Analysis Panel Styles
   ============================================ */

.data-table-container {
    margin-bottom: 20px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.table-header h3 {
    color: #667eea;
}

body.theme-dark .table-actions input {
    background: #1a1a1a;
    border-color: #333;
    color: #fff;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

th {
    padding: 15px;
    text-align: center;
    font-weight: 600;
}

tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.3s;
}

tbody tr:hover {
    background: #f8f9fa;
}

td {
    padding: 12px 15px;
    text-align: center;
}

.alert-filters label {
    transition: all 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
}

.alert-filters label:hover {
    background: #e9ecef;
}

.alert-filters input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.no-data {
    text-align: center;
    color: #999;
    padding: 40px !important;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: bold;
}

.badge-danger {
    background-color: #ef4444;
    color: white;
}

.badge-warning {
    background-color: #f59e0b;
    color: white;
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: white;
    margin-top: 20px;
    font-size: 1.2em;
}

@media (max-width: 768px) {
    .filter-row {
        grid-template-columns: 1fr;
    }
    
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .table-actions input {
        min-width: 100%;
    }
}

/* ================== تقویم شمسی ================== */
.persian-date-input {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s;
    cursor: pointer;
    background: white;
    width: 100%;
    font-family: inherit;
}

.persian-date-input:hover {
    border-color: #667eea;
}

.persian-date-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.persian-calendar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.persian-calendar {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    min-width: 320px;
    max-width: 90vw;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.close-btn {
    background: #fee2e2 !important;
    color: #ef4444 !important;
    border-radius: 50% !important;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem !important;
    padding: 0 !important;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #fecaca !important;
    transform: rotate(90deg);
}

body.theme-dark .close-btn {
    background: #450a0a !important;
    color: #f87171 !important;
}

.calendar-header button {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #1e293b;
    padding: 5px 10px;
    transition: all 0.2s;
}

.calendar-header button:hover {
    color: #667eea;
}

.month-year-selector {
    display: flex;
    align-items: center;
    gap: 15px;
}

.month-year-selector span {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    min-width: 150px;
    text-align: center;
}

.nav-btn {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.nav-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.calendar-weekdays div {
    text-align: center;
    font-weight: 600;
    color: #764ba2;
    padding: 10px 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.calendar-day:not(.empty):hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.calendar-day.selected {
    background: #667eea;
    color: white;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.calendar-day.today {
    background: #764ba2;
    color: white;
    font-weight: 700;
}

.calendar-day.empty {
    cursor: default;
}

.calendar-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #e2e8f0;
}

.time-picker {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 12px;
}

.time-input-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.number-input {
    display: flex;
    align-items: center;
    gap: 5px;
}

.time-nav {
    background: #e2e8f0;
    border: none;
    border-radius: 4px;
    width: 25px;
    height: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.time-nav:hover {
    background: #cbd5e1;
}

.time-picker label {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.9rem;
}

.time-picker input[type="number"] {
    width: 60px;
    padding: 8px;
    text-align: center;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    -moz-appearance: textfield;
}

.time-picker input[type="number"]::-webkit-outer-spin-button,
.time-picker input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.footer-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.today-btn {
    padding: 12px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.confirm-btn {
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.today-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.confirm-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ================== Grid Layout برای Checkbox ها ================== */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

@media (max-width: 640px) {
    .checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.checkbox-item:hover {
    border-color: #667eea;
    background: #f1f5f9;
    transform: translateY(-2px);
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

/* Responsive برای تقویم */
@media (max-width: 480px) {
    .persian-calendar {
        min-width: 280px;
        padding: 15px;
    }
    
    .month-year-selector span {
        font-size: 0.95rem;
        min-width: 120px;
    }
    
    .calendar-day {
        font-size: 0.9rem;
    }
}
