/* --- الألوان المعتمدة (Brand Identity) --- */
:root {
    --primary-color: #06213A; /* أزرق داكن */
    --secondary-color: #c1ae7a; /* ذهبي / بيج */
    --text-color: #3B3B3B; /* رمادي داكن للنصوص */
    --bg-color: #FFFFFF; /* خلفية الفورم */
    --body-bg: #f4f6f9; /* خلفية الصفحة الخارجية لإبراز الفورم */
    --input-bg: #fafafa;
    --border-color: #e0e0e0;
    --error-color: #d32f2f;
    --success-color: #2e7d32;
    --radius: 10px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--body-bg);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
}

/* --- الحاوية الرئيسية --- */
.app-container {
    background-color: var(--bg-color);
    width: 100%;
    max-width: 800px;
    padding: 35px;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(6, 33, 58, 0.08);
    border-top: 6px solid var(--secondary-color);
}

/* التجاوب مع الجوال (Mobile Responsiveness) */
@media (max-width: 600px) {
    body { padding: 10px; }
    .app-container { padding: 25px 15px; border-radius: 8px; }
}

/* --- الهيدر والنصوص --- */
.logo-container {
    text-align: center;
    margin-bottom: 35px;
}
.logo { max-width: 180px; height: auto; }

.header-text {
    text-align: center;
    margin-bottom: 30px;
}
h2 {
    color: var(--primary-color);
    font-size: clamp(1.5rem, 5vw, 1.8rem);
    margin-bottom: 8px;
}
p {
    color: var(--text-color);
    opacity: 0.8;
    font-size: 0.95rem;
}

.section-title {
    color: var(--primary-color);
    font-size: 1.15rem;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--body-bg);
}
.divider {
    border: none;
    height: 1px;
    background-color: var(--border-color);
    margin: 30px 0;
}

/* --- إدارة الشاشات --- */
.screen { display: none; animation: fadeIn 0.4s ease; }
.screen.active { display: block; }
.hidden { display: none !important; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- تصميم الشبكة للحقول --- */
.form-section { margin-bottom: 25px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.full-width { grid-column: 1 / -1; }

@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; gap: 15px; }
}

/* --- الحقول والنماذج --- */
.input-group {
    display: flex;
    flex-direction: column;
}
label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--primary-color);
}
.required { color: var(--error-color); }
.optional { color: var(--text-color); opacity: 0.6; font-size: 0.8rem; font-weight: normal; }

input, select, textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: all 0.3s ease;
    min-height: 48px; /* حجم مريح للمس في الجوال */
}
textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    background-color: var(--bg-color);
    box-shadow: 0 0 0 2px rgba(193, 174, 122, 0.2);
}

.readonly-input {
    background-color: #eeeeee;
    color: #666;
    border-color: transparent;
    cursor: not-allowed;
}

/* سهم القائمة المنسدلة */
.select-wrapper { position: relative; }
.select-wrapper::after {
    content: "▼";
    font-size: 0.8rem;
    color: var(--primary-color);
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
select { appearance: none; padding-right: 35px; }

/* --- مساحة رفع الملفات --- */
.file-upload-wrapper { width: 100%; }
.file-input { display: none; }

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    border: 2px dashed var(--secondary-color);
    border-radius: 8px;
    background-color: rgba(193, 174, 122, 0.03);
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}
.file-label:hover { background-color: rgba(193, 174, 122, 0.1); }

.file-title { margin-top: 10px; font-weight: 600; color: var(--primary-color); }
.file-desc { margin-top: 5px; font-size: 0.85rem; color: var(--text-color); opacity: 0.7; }

/* قائمة الملفات المرفقة وتصميم أيقونة الحذف */
.file-list-container {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--body-bg);
    padding: 12px 15px;
    border-radius: 6px;
    border-right: 4px solid var(--secondary-color);
    font-size: 0.9rem;
}
.file-info-text { display: flex; flex-direction: column; }
.file-name { font-weight: 500; color: var(--primary-color); word-break: break-all; }
.file-size { font-size: 0.8rem; color: #666; margin-top: 2px; }

.btn-delete {
    background: none;
    border: none;
    color: var(--error-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    margin-left: 10px;
    transition: transform 0.2s;
}
.btn-delete:hover { transform: scale(1.2); }

/* --- الأزرار --- */
#screen-1 .btn-primary {
    margin-top: 25px; /* حل مشكلة التصاق الزر بحقل الإدخال */
}

.btn-primary {
    width: 100%;
    background-color: var(--primary-color);
    color: var(--bg-color);
    border: none;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    min-height: 54px;
}
.btn-primary:hover { background-color: #041628; }
.btn-primary:disabled { background-color: #8fa0b0; cursor: not-allowed; }

/* --- التنبيهات والتحميل --- */
.alert {
    padding: 14px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 0.95rem;
    text-align: center;
    font-weight: 500;
}
.alert.error { background-color: #fdecea; color: var(--error-color); border: 1px solid #f5c6cb; }
.alert.success { background-color: #e8f5e9; color: var(--success-color); border: 1px solid #c8e6c9; }

.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }