/* ==========================================================================
   Sedachin (صداچین) Core Stylesheet
   پالت رنگی فیروزه‌ای ایرانی و طراحی واکنش‌گرا
   ========================================================================== */

:root {
    --sedachin-blue: #0284C7;
    --sedachin-sky: #38BDF8;
    --sedachin-blue-soft: #E0F2FE;
    --sedachin-saffron: #F59E0B;
    --sedachin-saffron-soft: #FEF3C7;
    --bg-canvas: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-subtle: #F1F5F9;
    --border-card: #E2E8F0;
    --text-main: #0F172A;
    --text-body: #334155;
    --text-muted: #64748B;
    --record-active: #EF4444;
    --record-active-soft: #FEE2E2;
    --action-submit: #10B981;
    --action-rerecord: #E2E8F0;
    --rule-bg: #FFFBEB;
    --rule-border: #FDE68A;
    --rule-text: #B45309;
    --history-bg: #F0FDF4;
    --history-border: #BBF7D0;
    --history-text: #166534;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Vazirmatn", Tahoma, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-canvas);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    padding: 16px;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 520px;
}

/* Header & Brand */
header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
    gap: 6px;
}

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

.brand-logo {
    width: 36px;
    height: 36px;
}

.brand-title {
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--sedachin-blue);
}

.brand-tagline {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.progress-badge {
    background: var(--sedachin-blue-soft);
    color: var(--sedachin-blue);
    font-size: 0.86rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 999px;
}

/* Task Card */
.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px dashed var(--border-card);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.task-id {
    font-weight: 800;
    font-size: 1.05rem;
}

.category-tag {
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--bg-subtle);
    color: var(--sedachin-blue);
    padding: 4px 10px;
    border-radius: 8px;
}

.section-block {
    margin-bottom: 14px;
}

.section-title {
    font-weight: 800;
    font-size: 0.92rem;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-content {
    font-size: 0.94rem;
    color: var(--text-body);
    background: var(--bg-subtle);
    padding: 10px 14px;
    border-radius: 10px;
    border-right: 3px solid var(--sedachin-blue);
    line-height: 1.7;
}

/* Conditional Boxes (History & Rules) */
.conditional-box {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 14px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.history-box {
    background: var(--history-bg);
    border: 1px solid var(--history-border);
    color: var(--history-text);
}

.rule-box {
    background: var(--rule-bg);
    border: 1px solid var(--rule-border);
    color: var(--rule-text);
}

.box-title {
    font-weight: 800;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Accordion for Sample Utterance (Anti-Priming) */
.sample-accordion {
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-card);
}

.sample-toggle-btn {
    width: 100%;
    background: var(--bg-subtle);
    border: none;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-body);
    cursor: pointer;
    transition: background 0.2s;
}

.sample-toggle-btn:hover {
    background: #E2E8F0;
}

.sample-drawer {
    background: var(--sedachin-saffron-soft);
    border-top: 1px dashed var(--sedachin-saffron);
    padding: 12px 14px;
    font-size: 0.92rem;
    color: #78350F;
    font-weight: 600;
    line-height: 1.6;
}

/* Recording Controls & Buttons */
.controls-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.btn-record {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 14px;
    background: var(--sedachin-blue);
    color: white;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: transform 0.1s, background 0.2s;
}

.btn-record.recording {
    background: var(--record-active);
    box-shadow: 0 0 0 6px var(--record-active-soft);
}

.timer-display {
    font-size: 1rem;
    font-weight: 800;
    color: var(--record-active);
}

.audio-preview {
    width: 100%;
    border-radius: 8px;
}

.post-record-actions {
    display: flex;
    width: 100%;
    gap: 10px;
}

.btn-action {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    transition: opacity 0.2s;
}

.btn-submit {
    background: var(--action-submit);
    color: white;
}

.btn-rerecord {
    background: var(--action-rerecord);
    color: var(--text-body);
}

.btn-skip {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    padding: 6px;
}

/* Feedback & Modal */
.feedback-banner {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 12px;
    background: #FEE2E2;
    color: #B91C1C;
    border: 1px solid #FCA5A5;
}

.hidden {
    display: none !important;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    z-index: 1000;
}

.modal-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-card label {
    font-size: 0.85rem;
    font-weight: 700;
}

.modal-card input,
.modal-card select {
    padding: 12px;
    border: 1px solid var(--border-card);
    border-radius: 10px;
    font-size: 0.95rem;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}