/* ===== BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    direction: rtl;
    font-family: 'Heebo', sans-serif;
    font-size: 16px;
    color: #1E293B;
    background: #F8FAFC;
    scroll-behavior: smooth;
}

body {
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, #1E3A5F 0%, #2563EB 50%, #3B82F6 100%);
    color: #fff;
    padding: 2.5rem 2rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.header::before {
    content: '';
    position: absolute; top: -50%; right: -20%;
    width: 60%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.07) 0%, transparent 70%);
    pointer-events: none;
}
.header h1 {
    font-size: 2.4rem; font-weight: 700;
    margin: 0; letter-spacing: -0.5px;
}
.header .subtitle {
    color: #93C5FD; font-size: 0.95rem;
    font-weight: 400; letter-spacing: 1px;
    margin-top: 0.2rem;
}
.header .tagline {
    color: #BFDBFE; font-size: 1.05rem;
    font-weight: 300; margin-top: 0.5rem;
}
.header-status { margin-top: 1rem; }

/* ===== CONTAINER ===== */
.container {
    max-width: 900px;
    margin: -1.5rem auto 2rem;
    padding: 0 1.2rem;
    position: relative; z-index: 1;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 0;
    background: #fff;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
    direction: rtl;
}
.tab {
    flex: 1;
    padding: 1rem 0.5rem;
    border: none;
    background: transparent;
    font-family: 'Heebo', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: #64748B;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    direction: rtl;
    text-align: center;
}
.tab:hover { background: #F1F5F9; color: #1E293B; }
.tab.active {
    color: #2563EB;
    border-bottom-color: #2563EB;
    font-weight: 600;
    background: #EFF6FF;
}

.tab-content {
    display: none;
    background: #fff;
    padding: 1.8rem;
    border-radius: 0 0 14px 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    direction: rtl;
    text-align: right;
}
.tab-content.active { display: block; }

/* ===== CARDS ===== */
.card {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 1.3rem 1.5rem;
    margin-bottom: 1rem;
    direction: rtl;
    text-align: right;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.card h3, .card h4 {
    color: #1E3A5F; font-weight: 600;
    margin-bottom: 0.5rem; font-size: 1.1rem;
}
.card p {
    color: #475569; line-height: 1.7;
    font-size: 0.95rem; margin: 0;
}

.card-accent { border-right: 4px solid #3B82F6 !important; }
.card-success { border-right: 4px solid #22C55E !important; }
.card-live { border-right: 4px solid #EF4444 !important; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.35rem 0.9rem; border-radius: 999px;
    font-size: 0.82rem; font-weight: 500;
    font-family: 'Heebo', sans-serif;
}
.badge-green  { background: #DCFCE7; color: #166534; }
.badge-blue   { background: #DBEAFE; color: #1E40AF; }
.badge-amber  { background: #FEF3C7; color: #92400E; }
.badge-red    { background: #FEE2E2; color: #991B1B; }
.badge-slate  { background: #F1F5F9; color: #475569; }

.badges-row {
    display: flex; gap: 0.5rem; flex-wrap: wrap;
    direction: rtl; margin: 0.8rem 0;
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
    border: 2px dashed #CBD5E1;
    border-radius: 14px;
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #FAFCFF;
    margin-bottom: 1rem;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: #3B82F6;
    background: #EFF6FF;
}
.upload-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.upload-text { font-size: 1.05rem; font-weight: 500; color: #334155; }
.upload-hint { font-size: 0.85rem; color: #94A3B8; margin-top: 0.3rem; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.7rem 1.6rem; border-radius: 10px;
    font-family: 'Heebo', sans-serif; font-size: 1rem; font-weight: 600;
    border: none; cursor: pointer;
    transition: all 0.2s; direction: rtl;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled {
    opacity: 0.5; cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,0.25);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 20px rgba(37,99,235,0.35); }

.btn-blue {
    background: #DBEAFE; color: #1E40AF;
}
.btn-blue:hover:not(:disabled) { background: #BFDBFE; }

.btn-outline {
    background: transparent; color: #3B82F6;
    border: 2px solid #3B82F6;
}
.btn-outline:hover:not(:disabled) { background: #EFF6FF; }

.btn-record {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: #fff;
    box-shadow: 0 4px 12px rgba(239,68,68,0.25);
    min-width: 160px;
}
.btn-record.recording {
    background: linear-gradient(135deg, #1E293B, #334155);
    animation: btn-pulse 1.5s infinite;
}
@keyframes btn-pulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(30,41,59,0.25); }
    50% { box-shadow: 0 4px 20px rgba(239,68,68,0.4); }
}

.full-width { width: 100%; margin-top: 1rem; }

.btn-row {
    display: flex; gap: 0.8rem; margin-top: 1rem;
    flex-wrap: wrap; direction: rtl;
}

/* ===== RECORDER ===== */
.recorder-controls {
    display: flex; align-items: center; gap: 1rem;
    justify-content: center; margin: 1.5rem 0;
    direction: rtl;
}
.rec-timer {
    font-size: 1.4rem; font-weight: 700;
    color: #EF4444; font-variant-numeric: tabular-nums;
}

/* ===== CAMERA ===== */
.camera-area {
    position: relative; text-align: center;
    margin: 1rem 0;
}
.camera-video {
    width: 100%; max-width: 640px;
    border-radius: 14px; background: #000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}
.rec-badge {
    position: absolute; top: 12px; right: 12px;
    background: rgba(239,68,68,0.9); color: #fff;
    padding: 5px 14px; border-radius: 20px;
    font-size: 0.85rem; font-weight: 600;
    font-family: 'Heebo', sans-serif;
}

/* ===== PREVIEW ===== */
.preview { margin: 1rem 0; }
.preview audio { width: 100%; border-radius: 10px; }

/* ===== SETTINGS ===== */
.settings-bar {
    display: flex; gap: 1.5rem; align-items: center;
    justify-content: flex-start;
    padding: 1rem 1.2rem;
    margin-top: 1.5rem;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    direction: rtl;
}
.settings-bar label {
    font-size: 0.9rem; font-weight: 500;
    color: #475569; display: flex; align-items: center; gap: 0.5rem;
}
.settings-bar select {
    padding: 0.4rem 0.8rem;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    font-family: 'Heebo', sans-serif;
    font-size: 0.9rem;
    direction: rtl;
}

/* ===== PROGRESS ===== */
.progress-area {
    margin: 2rem 0;
    text-align: center;
}
.progress-bar {
    height: 8px; background: #E2E8F0;
    border-radius: 999px; overflow: hidden;
}
.progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, #3B82F6, #22C55E);
    border-radius: 999px;
    transition: width 0.4s ease;
}
.progress-text {
    margin-top: 0.6rem;
    font-size: 0.95rem; font-weight: 500;
    color: #475569;
}

/* ===== RESULTS ===== */
.results {
    margin-top: 2rem;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
}

.result-tabs {
    display: flex; gap: 0;
    border-bottom: 1px solid #E2E8F0;
    direction: rtl;
}
.result-tab {
    flex: 1;
    padding: 0.9rem 0.5rem;
    border: none; background: transparent;
    font-family: 'Heebo', sans-serif;
    font-size: 0.95rem; font-weight: 500;
    color: #64748B; cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    text-align: center;
}
.result-tab:hover { background: #F8FAFC; }
.result-tab.active {
    color: #2563EB;
    border-bottom-color: #2563EB;
    font-weight: 600;
}

.result-content {
    display: none;
    padding: 1.8rem;
    direction: rtl;
    text-align: right;
}
.result-content.active { display: block; }

.section-title {
    font-size: 1.2rem; font-weight: 600;
    color: #1E3A5F; margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #DBEAFE;
}

/* ===== TEXT EDITOR ===== */
.text-editor {
    width: 100%;
    padding: 1rem 1.2rem;
    border: 1px solid #CBD5E1;
    border-radius: 10px;
    font-family: 'Heebo', sans-serif;
    font-size: 1rem; line-height: 1.8;
    color: #1E293B;
    direction: rtl; text-align: right;
    resize: vertical;
    transition: border-color 0.2s;
}
.text-editor:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ===== FORMS ===== */
.form-row {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 1rem; margin-bottom: 1rem;
}
.form-group label {
    display: block; font-size: 0.9rem;
    font-weight: 500; color: #475569;
    margin-bottom: 0.3rem;
}
.form-group input, .form-group select {
    width: 100%; padding: 0.6rem 1rem;
    border: 1px solid #CBD5E1; border-radius: 8px;
    font-family: 'Heebo', sans-serif; font-size: 0.95rem;
    direction: rtl;
}
.form-group input:focus, .form-group select:focus {
    outline: none; border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ===== LIVE DOT ===== */
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.3; } }
.live-dot {
    display: inline-block; width: 10px; height: 10px;
    background: #EF4444; border-radius: 50%;
    animation: pulse 1.2s infinite;
    margin-left: 6px; vertical-align: middle;
}

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    color: #94A3B8; font-size: 0.82rem;
    padding: 2rem 1rem 1.5rem;
    border-top: 1px solid #E2E8F0;
    margin-top: auto;
    direction: rtl;
}
.footer strong { color: #64748B; font-weight: 600; }

/* ===== UTILITIES ===== */
.hidden { display: none !important; }

.rtl-content {
    direction: rtl; text-align: right;
    line-height: 1.9; font-size: 1rem;
    white-space: pre-wrap;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .container { padding: 0 0.8rem; }
    .tabs { flex-wrap: wrap; }
    .tab { font-size: 0.85rem; padding: 0.75rem 0.3rem; }
    .form-row { grid-template-columns: 1fr; }
    .header h1 { font-size: 1.8rem; }
    .btn-row { flex-direction: column; }
}
