* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Vazirmatn, sans-serif !important;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: Vazirmatn, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.wrapper {
    width: 80%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* نوار تب‌ها */
.tabs-bar {
    background: white;
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    background: transparent;
    color: #6b7280;
}

.tab-btn:hover:not(.disabled) {
    background: #f3f4f6;
}

.tab-btn.active {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* مستطیل اصلی */
.main-container {
    width: 100%;
    height: 80vh;
    background: white;
    border-radius: 30px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.3);
    display: flex;
    position: relative;
    overflow: hidden;
}

/* محتوای تب‌ها */
.tab-content {
    display: none;
    width: 100%;
    height: 100%;
}

.tab-content.active {
    display: flex;
}

/* بخش تایمر */
#tab-timer {
    flex-direction: row;
}
.timer-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.timer-display {
    font-size: 96px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 20px;
    font-variant-numeric: tabular-nums;
}

.session-info {
    text-align: center;
    margin-bottom: 30px;
    max-width: 400px;
}

.session-title {
    font-size: 20px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.session-meta {
    font-size: 15px;
    color: #6b7280;
}

.main-btn {
    padding: 18px 48px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.main-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.4);
}

.controls {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.control-btn {
    padding: 14px 32px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.control-btn.pause { background: #fef3c7; color: #92400e; }
.control-btn.resume { background: #dbeafe; color: #1e40af; }
.control-btn.stop { background: #fee2e2; color: #991b1b; }
.control-btn:hover { transform: translateY(-2px); }

/* لاگ در سمت راست */
.log-section {
    width: 300px;
    background: #f9fafb;
    padding: 24px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.log-header {
    font-size: 14px;
    font-weight: 700;
    color: #6b7280;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.log-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.log-list::-webkit-scrollbar { width: 6px; }
.log-list::-webkit-scrollbar-track { background: transparent; }
.log-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }

.log-item {
    padding: 10px 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    border-right: 3px solid #6366f1;
    font-size: 12px;
}

.log-item.start { border-right-color: #10b981; }
.log-item.pause { border-right-color: #f59e0b; }
.log-item.resume { border-right-color: #3b82f6; }
.log-item.stop { border-right-color: #ef4444; }

.log-time {
    color: #9ca3af;
    font-size: 10px;
    margin-bottom: 4px;
}

.log-message {
    color: #374151;
    font-weight: 500;
    line-height: 1.4;
}

/* تب تقویم */
.calendar-container {
    width: 100%;
    height: 100%;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    justify-content: center;
}

.calendar-wrapper {
    width: 100%;
    max-width: 500px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.nav-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.nav-btn:hover { background: #e5e7eb; transform: scale(1.1); }

.calendar-title {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 7px;
    margin-bottom: 7px;
}

.weekday {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    padding: 8px 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 7px;
}

.day-cell {
    aspect-ratio: 1;
    border-radius: 10px;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
}

.day-cell.empty { cursor: default; opacity: 0; border: none; }
.day-cell:not(.empty):hover { border-color: #6366f1; transform: translateY(-3px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); }
.day-cell.today { border-color: #10b981 !important; border-width: 3px; box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1); }
.day-number { font-size: 13px; font-weight: 700; color: #1a1a2e; margin-bottom: 5px; }
.day-hours { font-size: 9px; font-weight: 700; color: #000000; background: rgba(255, 255, 255, 0.8); padding: 2px 5px; border-radius: 4px; }
.day-cell.empty .day-number { display: none; }

/* رنگ‌بندی تقویم */
.day-cell[data-hours="0"] { background: #f9fafb; border-color: #e5e7eb; }
.day-cell[data-hours="1"] { background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%); border-color: #bae6fd; }
.day-cell[data-hours="2"] { background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%); border-color: #93c5fd; }
.day-cell[data-hours="3"] { background: linear-gradient(135deg, #93c5fd 0%, #60a5fa 100%); border-color: #60a5fa; }
.day-cell[data-hours="4"] { background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%); border-color: #3b82f6; }
.day-cell[data-hours="5"] { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); border-color: #2563eb; }
.day-cell[data-hours="6"] { background: linear-gradient(135deg, #fbbf24 0%, #fb923c 100%); border-color: #fb923c; }
.day-cell[data-hours="7"] { background: linear-gradient(135deg, #fb923c 0%, #f97316 100%); border-color: #f97316; }
.day-cell[data-hours="8"] { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); border-color: #ea580c; }
.day-cell[data-hours="9"] { background: linear-gradient(135deg, #f87171 0%, #ef4444 100%); border-color: #ef4444; }
.day-cell[data-hours="10"], .day-cell[data-hours="11"], .day-cell[data-hours="12"] { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); border-color: #dc2626; }

/* تب آمار */
.stats-container { width: 100%; height: 100%; padding: 25px; overflow-y: auto; background: #f9fafb; }
.stats-container::-webkit-scrollbar { width: 8px; }
.stats-container::-webkit-scrollbar-track { background: #f3f4f6; }
.stats-container::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }

.timeline-selector { background: white; border-radius: 16px; padding: 16px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); }
.timeline-title { font-size: 14px; font-weight: 700; color: #6b7280; margin-bottom: 12px; }
.timeline-options { display: flex; flex-wrap: wrap; gap: 8px; }
.timeline-btn { padding: 8px 16px; border: 2px solid #e5e7eb; background: white; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: #6b7280; transition: all 0.2s; }
.timeline-btn:hover { border-color: #6366f1; color: #6366f1; }
.timeline-btn.active { background: #6366f1; border-color: #6366f1; color: white; }

.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: white; border-radius: 16px; padding: 20px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); border-right: 4px solid #6366f1; }
.stat-card.success { border-right-color: #10b981; }
.stat-card.warning { border-right-color: #f59e0b; }
.stat-card.danger { border-right-color: #ef4444; }
.stat-label { font-size: 13px; color: #6b7280; margin-bottom: 8px; font-weight: 600; }
.stat-value { font-size: 32px; font-weight: 700; color: #1a1a2e; margin-bottom: 4px; }
.stat-unit { font-size: 14px; color: #9ca3af; }
.stat-change { font-size: 12px; font-weight: 600; margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.stat-change.positive { color: #10b981; }
.stat-change.negative { color: #ef4444; }

.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.chart-card { background: white; border-radius: 16px; padding: 24px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); }
.chart-title { font-size: 16px; font-weight: 700; color: #1a1a2e; margin-bottom: 16px; }
.chart-wrapper { position: relative; height: 250px; }

/* پاپ‌آپ‌ها */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); z-index: 1000; justify-content: center; align-items: center; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal { background: white; border-radius: 24px; padding: 40px; width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4); animation: modalSlide 0.3s ease-out; }
.modal::-webkit-scrollbar { width: 6px; }
.modal::-webkit-scrollbar-track { background: #f3f4f6; border-radius: 10px; }
.modal::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
@keyframes modalSlide { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
.modal-title { font-size: 24px; font-weight: 700; color: #1a1a2e; margin-bottom: 24px; text-align: center; }
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 8px; }
.form-input { width: 100%; padding: 12px 16px; border: 2px solid #e5e7eb; border-radius: 10px; font-size: 15px; transition: border-color 0.2s; background: #f9fafb; }
.form-input:focus { outline: none; border-color: #6366f1; background: white; }
.options-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.options-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.option-btn { padding: 12px 8px; border: 2px solid #e5e7eb; background: white; border-radius: 8px; cursor: pointer; transition: all 0.2s; font-size: 13px; font-weight: 600; color: #6b7280; }
.option-btn:hover { border-color: #6366f1; color: #6366f1; }
.option-btn.selected { background: #6366f1; border-color: #6366f1; color: white; }
.modal-buttons { display: flex; gap: 12px; margin-top: 28px; }
.modal-btn { flex: 1; padding: 14px; border: none; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.modal-btn.cancel { background: #f3f4f6; color: #6b7280; }
.modal-btn.submit { background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); color: white; }
.modal-btn:hover { transform: translateY(-2px); }
.session-card { background: #f9fafb; border-radius: 12px; padding: 16px; margin-bottom: 12px; border-right: 4px solid #6366f1; }
.session-card-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 8px; }
.session-card-title { font-size: 16px; font-weight: 600; color: #1a1a2e; }
.session-card-time { font-size: 13px; color: #6b7280; font-weight: 500; }
.session-card-meta { font-size: 13px; color: #6b7280; margin-bottom: 12px; }
.view-details-btn { width: 100%; padding: 10px; background: white; border: 2px solid #e5e7eb; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: #6366f1; transition: all 0.2s; }
.view-details-btn:hover { background: #f3f4f6; border-color: #6366f1; }
.detail-log-item { padding: 12px; background: #f9fafb; border-radius: 8px; margin-bottom: 8px; border-right: 3px solid #6366f1; }
.detail-log-item.start { border-right-color: #10b981; }
.detail-log-item.pause { border-right-color: #f59e0b; }
.detail-log-item.resume { border-right-color: #3b82f6; }
.detail-log-item.stop { border-right-color: #ef4444; }
.detail-log-time { font-size: 11px; color: #9ca3af; margin-bottom: 4px; }
.detail-log-message { font-size: 13px; color: #374151; font-weight: 500; }
.hidden { display: none !important; }

/* تب یادداشت */
.notes-container { width: 100%; height: 100%; display: flex; flex-direction: column; padding: 25px; background: #f9fafb; }
.notes-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding: 0 10px; }
.notes-date { font-size: 18px; font-weight: 700; color: #1a1a2e; }
.notes-nav-btn { width: 36px; height: 36px; border: none; background: #f3f4f6; border-radius: 10px; cursor: pointer; font-size: 18px; transition: all 0.2s; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.notes-nav-btn:hover { background: #e5e7eb; transform: scale(1.1); }
.notes-page { flex: 1; background: #fff9e0; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); padding: 20px; }
.notes-textarea { width: 100%; height: 100%; border: none; outline: none; resize: none; font-size: 16px; line-height: 2.2; color: #374151; background: transparent; background-image: linear-gradient(to bottom, #e5e7eb 1px, transparent 1px); background-size: 100% 2.2em; background-attachment: local; padding-top: 4px; }
.notes-textarea::-webkit-scrollbar { width: 8px; }
.notes-textarea::-webkit-scrollbar-track { background: transparent; }
.notes-textarea::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }

/* --- AI TAB STYLES --- */
#tab-ai { background: #f9fafb; position: relative; }
.ai-layout-container { display: flex; width: 100%; height: 100%; }
.ai-sidebar { width: 320px; height: 100%; background: #ffffff; border-left: 1px solid #e5e7eb; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 20px; border-bottom: 1px solid #e5e7eb; }
.sidebar-header h3 { font-size: 18px; color: #1a1a2e; margin-bottom: 16px; }
#aiPromptSearch { width: 100%; padding: 10px 12px; border: 2px solid #e5e7eb; border-radius: 8px; font-size: 13px; background: #f9fafb; transition: all 0.2s; }
#aiPromptSearch:focus { outline: none; border-color: #6366f1; background: white; }
.ai-prompt-groups { flex: 1; overflow-y: auto; padding: 12px; min-height: 0; }
.ai-prompt-groups::-webkit-scrollbar { width: 6px; }
.ai-prompt-groups::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
.prompt-category { margin-bottom: 16px; }
.prompt-category-title { font-size: 12px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; padding: 8px 12px; margin-bottom: 4px; }
.ai-prompt-item { display: block; width: 100%; padding: 12px 16px; border: none; background: transparent; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; color: #374151; transition: all 0.2s; text-align: right; }
.ai-prompt-item:hover { background: #f3f4f6; color: #1a1a2e; }
.ai-prompt-item.active { background: #ede9fe; color: #6366f1; font-weight: 600; }
.ai-content-area { flex: 1; height: 100%; padding: 30px; overflow-y: auto; display: flex; flex-direction: column; min-width: 0; }
.ai-content-area::-webkit-scrollbar { width: 8px; }
.ai-content-area::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
#aiOnboarding { position: absolute; top: 0; left: 0; z-index: 20; background: #f9fafb; }
.ai-content-area .ai-placeholder { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.ai-content-area .ai-response-content { flex-grow: 1; }
.ai-content-area .spinner { margin: auto; }
.ai-response-content table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; }
.ai-response-content th, .ai-response-content td { border: 1px solid #e5e7eb; padding: 10px 12px; text-align: right; }
.ai-response-content th { background-color: #f9fafb; font-weight: 600; }
.ai-response-content tr:nth-child(even) { background-color: #f9fafb; }
.ai-response-content ul { padding-right: 20px; margin: 10px 0; }
.ai-response-content li { margin-bottom: 8px; }
.onboarding-title { font-size: 28px; font-weight: 700; color: #1a1a2e; margin-bottom: 12px; }
.onboarding-subtitle { font-size: 16px; color: #6b7280; margin-bottom: 24px; max-width: 400px; }
.onboarding-form { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 350px; }
.ai-actions { text-align: center; margin-top: 20px; }
.spinner { width: 56px; height: 56px; border-radius: 50%; border: 6px solid #e5e7eb; border-top-color: #6366f1; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- RESPONSIVE DESIGN ("Shrink Desktop" approach) --- */
@media (max-width: 1024px) {
    body { padding: 0; }
    .wrapper { width: 100%; height: 100vh; border-radius: 0; gap: 0; }
    .main-container { height: 100%; border-radius: 0; }
    .tabs-bar { border-radius: 0; }
    .timer-display { font-size: 72px; }
    .log-section { width: 220px; padding: 15px; }
    .ai-sidebar { width: 250px; }
    .ai-content-area { padding: 20px; }
}

@media (max-width: 768px) {
    .tabs-bar { padding: 8px 4px; overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none; }
    .tabs-bar::-webkit-scrollbar { display: none; }
    .tab-btn { flex-shrink: 0; padding: 10px 16px; font-size: 13px; }
    .timer-display { font-size: 48px; }
    .main-btn { padding: 14px 28px; font-size: 16px; }
    .controls { gap: 8px; }
    .control-btn { padding: 10px 20px; font-size: 14px; }
    .log-section { width: 180px; padding: 12px; }
    .log-header { font-size: 12px; }
    .log-item { font-size: 11px; padding: 8px 10px; }
    .ai-sidebar { width: 200px; }
    .sidebar-header { padding: 15px; }
    .sidebar-header h3 { font-size: 16px; margin-bottom: 10px; }
    #aiPromptSearch { padding: 8px 10px; font-size: 12px; }
    .ai-prompt-groups { padding: 8px; }
    .prompt-category-title { font-size: 11px; padding: 6px 8px; }
    .ai-prompt-item { font-size: 13px; padding: 10px 12px; }
    .ai-content-area { padding: 15px; }
    .ai-response-content table { font-size: 12px; }
    .ai-response-content th, .ai-response-content td { padding: 8px; }
    .calendar-container { padding: 10px; }
    .calendar-grid, .weekdays { gap: 4px; }
    .day-number { font-size: 11px; }
    .day-hours { font-size: 8px; padding: 1px 3px; }
    .modal { padding: 25px; }
    .modal-title { font-size: 20px; }
}

@media (max-width: 480px) {
    .timer-display { font-size: 40px; }
    .log-section { width: 120px; padding: 10px; }
    .log-message { line-height: 1.3; }
    .ai-sidebar { width: 150px; }
    .sidebar-header { padding: 10px; }
    .sidebar-header h3 { font-size: 14px; }
    .prompt-category-title { font-size: 10px; }
    .ai-prompt-item { font-size: 12px; padding: 8px; }
    .options-grid { grid-template-columns: repeat(2, 1fr); }
}
