/* ستایلەکانی گشتی و دەفتەری پلان */
* {
    box-sizing: border-box;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

body {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    background-color: #f1f5f9;
    margin: 0;
    padding: 0;
    direction: rtl;
    color: #0f172a;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* هێدەری ئەپڵیکەیشن */
.app-header {
    background: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ئایکۆنی لۆگۆ لە تەنیشت ناونیشان */
.brand-logo-img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.brand-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: #064e3b;
}

.brand-subtitle {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

/* دوگمەی Gemini */
.btn-gemini {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff !important;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
    border-radius: 8px;
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-gemini:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

/* تابەکانی ناڤیگەیشن */
.app-tabs {
    display: flex;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
    gap: 8px;
    border-top: 1px solid #e2e8f0;
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 18px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: 0.2s;
    white-space: nowrap;
}

.tab-btn.active {
    color: #047857;
    border-bottom-color: #047857;
    font-weight: 800;
}

/* ناوەڕۆکی بەشەکان */
.main-content {
    max-width: 1300px;
    margin: 20px auto;
    padding: 0 15px;
    flex-grow: 1;
}

.tab-content {
    display: none;
}

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

/* شریتی ئامرازەکان (Toolbar) */
.toolbar {
    background: #ffffff;
    padding: 14px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.upload-box {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.file-label {
    background-color: #2563eb;
    color: #fff;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.file-label:hover { background-color: #1d4ed8; }
input[type="file"] { display: none; }

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    border: none;
    padding: 9px 16px;
    font-size: 13.5px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}

.btn-word { background-color: #0d6efd; color: #fff; }
.btn-word:hover { background-color: #0b5ed7; }
.btn-print { background-color: #10b981; color: #fff; }
.btn-print:hover { background-color: #059669; }
.btn-paste-toggle { background-color: #6366f1; color: #fff; }
.btn-paste-toggle:hover { background-color: #4f46e5; }
.btn-ghost { background-color: #e2e8f0; color: #334155; }
.btn-ghost:hover { background-color: #cbd5e1; }

#status-msg {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

/* بەشی پەیستکردن */
#paste-section {
    display: none;
    background: #ffffff;
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

#paste-textarea {
    width: 100%;
    height: 180px;
    padding: 12px;
    font-family: inherit;
    font-size: 13px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    direction: rtl;
    box-sizing: border-box;
    outline: none;
}

#paste-textarea:focus { border-color: #6366f1; }

/* دیزاینی لاپەڕەی A4 Landscape پڕ بە پڕ */
.page {
    width: 297mm;
    height: 208mm;
    padding: 8mm 12mm 6mm 12mm;
    margin: 0 auto 25px auto;
    background: #ffffff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    page-break-after: always;
    break-after: page;
    overflow: hidden;
}

.header {
    text-align: center;
    border-bottom: 2px solid #000;
    padding-bottom: 5px;
    margin-bottom: 6px;
}

.header h1 { margin: 0; font-size: 17px; font-weight: 800; }
.header h2 { margin: 2px 0 0 0; font-size: 14px; font-weight: 600; color: #333; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    border: 1.5px solid #000;
    padding: 6px 8px;
    vertical-align: middle;
    text-align: right;
    line-height: 1.4;
}

th {
    background-color: #f1f5f9 !important;
    font-weight: 700;
    text-align: center;
}

.table-meta { margin-bottom: 8px; }
.table-meta th { width: 12%; background-color: #e2e8f0 !important; }
.table-meta td { text-align: center; }

.table-main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.table-main { height: 100%; }
.table-main th { font-size: 14px; background-color: #e2e8f0 !important; height: 28px; }
.table-main td.stage-title {
    width: 17%;
    font-weight: 800;
    text-align: center;
    background-color: #f8fafc;
    font-size: 13.5px;
}

.table-main td.time-col { width: 10%; text-align: center; font-weight: 700; }

.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    border-top: 1.5px solid #333;
    padding-top: 6px;
    margin-top: 4px;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    color: #64748b;
}

/* بەشی خشتەی هەفتانە */
.timetable-control-panel {
    background: #ffffff;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.timetable-inputs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex-grow: 1;
}

.timetable-inputs input {
    padding: 9px 12px;
    font-family: inherit;
    font-size: 13.5px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
    flex-grow: 1;
}

.timetable-inputs input:focus { border-color: #10b981; }

.btn-image-export {
    background-color: #059669;
    color: white;
}
.btn-image-export:hover { background-color: #047857; }

.timetable-container {
    background: #ffffff;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    max-width: 1000px;
    margin: 0 auto;
}

.tt-header {
    text-align: center;
    border-bottom: 2px solid #064e3b;
    padding-bottom: 12px;
    margin-bottom: 18px;
}

.tt-header h2 { margin: 0; font-size: 20px; color: #064e3b; font-weight: 800; }

.tt-meta-labels {
    display: flex;
    justify-content: space-around;
    margin-top: 8px;
    font-size: 13.5px;
    font-weight: 700;
    color: #475569;
}

.timetable-grid {
    width: 100%;
    border-collapse: collapse;
}

.timetable-grid th, .timetable-grid td {
    border: 1.5px solid #0f172a;
    padding: 10px 8px;
    text-align: center;
}

.timetable-grid th {
    background-color: #e2e8f0 !important;
    font-size: 14px;
}

.timetable-grid td.day-cell {
    background-color: #f1f5f9;
    font-weight: 800;
    font-size: 14.5px;
}

.timetable-grid td[contenteditable="true"] {
    min-height: 40px;
    cursor: text;
    font-weight: 600;
    transition: 0.2s;
}

.timetable-grid td[contenteditable="true"]:focus {
    background-color: #ecfdf5;
    outline: 2px solid #10b981;
}

.tt-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
}

/* بەشی ڕێنمایی */
.guide-card {
    background: #ffffff;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    max-width: 900px;
    margin: 0 auto;
}

.guide-card h2 { margin-top: 0; color: #064e3b; font-size: 20px; }
.guide-lead { font-size: 14.5px; color: #475569; line-height: 1.6; margin-bottom: 25px; }

.guide-steps { display: flex; flex-direction: column; gap: 20px; }

.step-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.step-num {
    background: #10b981;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
    flex-shrink: 0;
}

.step-body h3 { margin: 0 0 6px 0; font-size: 15.5px; color: #1e293b; }
.step-body p { margin: 0; font-size: 13.5px; color: #64748b; line-height: 1.5; }
.step-body ul { margin: 6px 0 0 0; padding-right: 20px; font-size: 13px; color: #475569; }

/* بڕگەی داگرتنی PWA */
.install-banner {
    background: linear-gradient(135deg, #064e3b, #047857);
    color: #ffffff;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    flex-wrap: wrap;
    gap: 10px;
}

.install-content { display: flex; align-items: center; gap: 12px; }
.install-banner-img {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: cover;
}
.install-text strong { font-size: 14.5px; display: block; }
.install-text p { margin: 2px 0 0 0; font-size: 12px; opacity: 0.9; }
.install-actions { display: flex; gap: 8px; }
.btn-primary-dark { background-color: #f59e0b; color: #000; font-weight: 800; }
.btn-primary-dark:hover { background-color: #d97706; }

/* ستایلی مافی خاوەندارێتی لە بەشی خوارەوە */
.app-footer {
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    padding: 15px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-top: 30px;
}

/* چاپکردنی فەرمی */
@media print {
    body { background: none; padding: 0; }
    .app-header, .toolbar, #paste-section, #install-banner, .timetable-control-panel, .guide-card, .app-footer {
        display: none !important;
    }
    .main-content { margin: 0; padding: 0; max-width: 100%; }
    .page { margin: 0; box-shadow: none; height: 100vh; width: 100vw; }
    @page { size: A4 landscape; margin: 6mm 8mm; }
}

@media (max-width: 768px) {
    .header-container { flex-direction: column; align-items: stretch; text-align: center; }
    .brand { justify-content: center; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .upload-box, .btn-group { justify-content: center; width: 100%; }
    .page { width: 100%; height: auto; min-height: 208mm; overflow-x: auto; }
}