@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --primary: #4f46e5;
    --accent: #f43f5e;
    --bg: #f8fafc;
    --card: #ffffff;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --success: #10b981;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg);
    font-family: 'Plus Jakarta Sans', sans-serif;
    display: flex;
    justify-content: center;
    padding: 20px;
    color: var(--text-dark);
}

.phone {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border-radius: 40px;
    padding: 25px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    position: relative;
    border: 8px solid #1e293b;
}

/* الشريط العلوي والنوتش */
.status-bar {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 20px;
    padding: 0 10px;
}

.notch {
    width: 120px;
    height: 20px;
    background: #1e293b;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* الهيدر */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.app-eyebrow { color: var(--primary); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.app-title { font-size: 22px; font-weight: 800; }

.server-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
}

.dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.dot.busy { background: var(--success); box-shadow: 0 0 8px var(--success); }

/* منطقة الرفع */
.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 24px;
    height: 220px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    background: #fcfcfc;
    margin-bottom: 20px;
}

.upload-zone.filled { border-style: solid; border-color: var(--primary); }

.preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0; left: 0;
}

#fileInput {
    position: absolute;
    width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
    z-index: 10;
}

/* خطوات المعالجة */
.section-label { font-size: 13px; font-weight: 700; margin-bottom: 12px; color: var(--text-light); text-transform: uppercase; }

.step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid #f1f5f9;
}

.step-n {
    width: 24px; height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: bold;
}

.step-label { flex: 1; font-size: 13px; font-weight: 500; }

/* الزرار */
.btn {
    width: 100%;
    padding: 18px;
    border-radius: 18px;
    border: none;
    background: var(--text-dark);
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin: 15px 0;
}

.btn:disabled { background: #cbd5e1; transform: none; }
.btn:active:not(:disabled) { transform: scale(0.97); }

/* كارت النتيجة الأساسية */
.result {
    display: none;
    margin-top: 10px;
    padding: 15px;
    background: #f1f5f9;
    border-radius: 20px;
    animation: fadeIn 0.4s ease;
}

.result.show { display: block; }

/* كارت التوصيات المعدل (حل مشكلة التداخل) */
.rec-card {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border-radius: 24px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #ddd6fe;
    display: none;
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.05);
}

.rec-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.rec-tag {
    background: var(--primary);
    color: white;
    padding: 5px 12px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.rec-type-pill {
    background: rgba(255, 255, 255, 0.7);
    padding: 5px 12px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
}

.rec-body {
    display: flex;
    flex-direction: column; /* جعل العناصر تحت بعضها */
    align-items: center;
    text-align: center;
    gap: 12px;
}

.rec-icon { font-size: 40px; }

.rec-text {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-dark);
    line-height: 1.4;
}

.rec-sub {
    font-size: 13px;
    color: var(--text-light);
    font-style: italic;
    line-height: 1.4;
}

/* الهيستوري والبادج السفلي */
.offline-badge {
    text-align: center;
    font-size: 11px;
    color: var(--text-light);
    padding: 15px 0;
    line-height: 1.5;
}

.history-section { margin-top: 20px; border-top: 1px solid #f1f5f9; padding-top: 20px; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.history-title { font-weight: 700; font-size: 14px; }
.clear-btn { background: none; border: none; color: var(--accent); font-weight: 700; font-size: 12px; cursor: pointer; }

/* أنيميشن */
.spinner {
    width: 20px; height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }