/* ========================================
   Contact Page Styles - Gulffix
   ======================================== */

/* ----------------------------------------
   Main Layout
   ---------------------------------------- */
.contact-page {
    padding: 80px 0;
    min-height: 70vh;
    background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
}

.contact-container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 0 30px;
}

/* ----------------------------------------
   Header Section
   ---------------------------------------- */
.contact-header {
    text-align: center;
    margin-bottom: 50px;
}

.contact-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #0b1f3a;
    margin-bottom: 15px;
    position: relative;
    display: inline-block;
}

.contact-header h2:after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: #ffc107;
    border-radius: 2px;
}

.contact-header p {
    font-size: 1.1rem;
    color: #666;
    margin-top: 20px;
}

/* ----------------------------------------
   Form Wrapper - تم إلغاء تحريك البوكس عند الهوفر
   ---------------------------------------- */
.contact-form-wrapper {
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 5px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

/* تم إلغاء تحريك البوكس عند تمرير الماوس */
.contact-form-wrapper:hover {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.12);
}

/* ----------------------------------------
   Alert Messages (مطابق لنظام auth)
   ---------------------------------------- */
.contact-alerts {
    padding: 20px 30px 0 30px;
}

/* تحسين عرض رسالة النجاح - تكون أقل عرضاً مع مسافات من اليمين واليسار */
.alert-message {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 0.95rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

/* جعل الرسالة أقل عرضاً مع مسافات من الجانبين */
.alert-message.success,
.alert-message.error {
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

/* للشاشات الكبيرة */
@media (min-width: 769px) {
    .alert-message.success,
    .alert-message.error {
        max-width: 80%;
        margin-left: auto;
        margin-right: auto;
    }
}

/* أنيميشن الرسائل */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-message {
    animation: slideDown 0.4s ease;
}

/* Success message */
.alert-message.success {
    background: linear-gradient(135deg, #d4edda 0%, #c8e6d9 100%);
    color: #155724;
    border-left: 4px solid #28a745;
}

/* Error message */
.alert-message.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.alert-content i {
    font-size: 1.3rem;
}

.alert-text {
    flex: 1;
    line-height: 1.4;
}

.alert-close {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: inherit;
}

.alert-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

/* ----------------------------------------
   Contact Form
   ---------------------------------------- */
.contact-form {
    padding: 30px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

/* تمديد المسافة عند ظهور رسالة خطأ */
.form-group:has(.field-error-message) {
    margin-bottom: 55px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.contact-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #0b1f3a;
    font-size: 0.9rem;
}

.contact-form label .required {
    color: #ffc107;
    margin-left: 3px;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e8ecef;
    border-radius: 12px;
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: #ffc107;
    background: white;
    box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.1);
}

.contact-form textarea {
    min-height: 140px;
    resize: vertical;
}

/* ----------------------------------------
   Inline Error Messages (مثل فورم تسجيل الدخول)
   ---------------------------------------- */

/* حركة الاهتزاز للحقل الخاطئ */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* حالة الخطأ للحقل */
.input-error {
    border: 2px solid #dc3545 !important;
    background-color: #fff8f8 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
    transition: all 0.3s ease;
    animation: shake 0.3s ease-out;
}

/* تلميح عند تمرير الماوس على الحقل الخاطئ */
.input-error:hover {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.25);
}

/* تركيز الحقل الخاطئ */
.input-error:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.2) !important;
}

/* رسالة الخطأ تحت الحقل - تظل مرئية حتى يغلقها المستخدم */
.field-error-message {
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 8px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    animation: slideDown 0.3s ease-out;
    font-weight: 500;
    background: #fff5f5;
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 3px solid #dc3545;
    transition: all 0.3s ease;
}

.field-error-message i {
    font-size: 14px;
    color: #dc3545;
}

.field-error-message .error-text {
    flex: 1;
    line-height: 1.4;
}

/* زر إغلاق رسالة الخطأ */
.error-close-btn {
    background: rgba(220, 53, 69, 0.1);
    border: none;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #dc3545;
    font-size: 10px;
}

.error-close-btn:hover {
    background: rgba(220, 53, 69, 0.2);
    transform: scale(1.1);
}

/* حالة الحقل الصحيح */
.contact-form input.valid,
.contact-form textarea.valid {
    border-color: #28a745;
    background-color: #f0fff4;
}

.contact-form input.error,
.contact-form textarea.error {
    border-color: #dc3545;
    background-color: #fff8f8;
}

/* ----------------------------------------
   Submit Button - Loading State (حالة التحميل)
   ---------------------------------------- */

/* زر الإرسال - الحالة العادية */
.submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #ffc107 0%, #ffda44 100%);
    color: #0b1f3a;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 193, 7, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* زر الإرسال - حالة التحميل (loading) */
.submit-btn.loading {
    opacity: 0.8;
    cursor: wait;
    transform: none;
    pointer-events: none;
}

.submit-btn.loading:hover {
    transform: none;
    box-shadow: none;
}

/* إخفاء أيقونة الطائرة أثناء التحميل */
.submit-btn.loading .fa-paper-plane {
    display: none !important;
}

/* إظهار spinner أثناء التحميل */
.submit-btn.loading .spinner {
    display: inline-block !important;
}

/* تغيير لون النص أثناء التحميل */
.submit-btn.loading .btn-text {
    opacity: 0.9;
}

/* Spinner - دائرة التحميل */
.spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(11, 31, 58, 0.3);
    border-top: 2px solid #0b1f3a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* حركة الدوران للـ Spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ----------------------------------------
   Math Question Section
   ---------------------------------------- */
.math-question {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 25px;
    border: 1px solid #e8ecef;
    transition: all 0.3s ease;
}

.math-question:hover {
    border-color: #ffc107;
    background: #fffef8;
}

.math-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    font-weight: 600;
    color: #0b1f3a;
}

.math-label i {
    font-size: 1.3rem;
    color: #ffc107;
}

.math-input-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    position: relative;
}

.math-question-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #0b1f3a;
    background: white;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid #e8ecef;
}

.math-input-group input {
    flex: 1;
    min-width: 150px;
    background: white;
    transition: all 0.3s ease;
}

.math-input-group input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.2);
}

.math-hint {
    font-size: 0.75rem;
    color: #999;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* States for math input */
.math-question input.error {
    border-color: #dc3545;
    background: #fff8f8;
}

.math-question input.valid {
    border-color: #28a745;
    background: #f0fff4;
}

/* رسالة الخطأ للسؤال الرياضي - تظهر أسفل يمين حقل الإدخال بنصف عرضه */
.math-question .field-error-message {
    position: absolute;
    bottom: -45px;
    right: 0;
    left: auto;
    width: 50%;
    min-width: 180px;
    margin-top: 0;
    font-size: 0.75rem;
    padding: 6px 10px;
}

/* Math refresh button */
.math-refresh {
    background: none;
    border: none;
    color: #ffc107;
    cursor: pointer;
    font-size: 1rem;
    margin-left: 10px;
    transition: transform 0.2s;
}

.math-refresh:hover {
    transform: rotate(90deg);
}

.math-refresh:focus {
    outline: none;
}

/* ----------------------------------------
   Success Message Top
   ---------------------------------------- */
.success-message-top {
    margin: 20px auto;
    max-width: 80%;
    animation: slideDown 0.3s ease-out;
}

/* ----------------------------------------
   Responsive Design
   ---------------------------------------- */
@media (max-width: 768px) {
    .contact-page {
        padding: 50px 0;
    }
    
    .contact-container {
        padding: 0 20px;
    }
    
    .contact-header h2 {
        font-size: 1.8rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .contact-form {
        padding: 20px;
    }
    
    .math-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .math-question-text {
        text-align: center;
    }
    
    .contact-alerts {
        padding: 15px 20px 0 20px;
    }
    
    /* تعديل المسافات للشاشات الصغيرة */
    .form-group:has(.field-error-message) {
        margin-bottom: 5px;
    }
    
    /* تعديل رسالة الخطأ للرياضيات على الشاشات الصغيرة */
    .math-question .field-error-message {
        position: relative;
        bottom: auto;
        right: auto;
        left: auto;
        width: 100%;
        margin-top: 8px;
    }
    
    .success-message-top {
        margin: 15px auto;
        max-width: 90%;
    }
    
    /* جعل الرسالة أقل عرضاً على الموبايل */
    .alert-message.success,
    .alert-message.error {
        max-width: 95%;
    }
    
    .field-error-message {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
    
    /* تعديل حجم الـ Spinner للشاشات الصغيرة */
    .spinner {
        width: 14px;
        height: 14px;
    }
    
    .submit-btn {
        padding: 14px;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .contact-header h2 {
        font-size: 1.5rem;
    }
    
    .contact-header p {
        font-size: 0.9rem;
    }
    
    .submit-btn {
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .alert-message {
        padding: 12px 16px;
    }
    
    .alert-content i {
        font-size: 1.1rem;
    }
    
    .field-error-message {
        font-size: 0.7rem;
        padding: 5px 8px;
    }
    
    .error-close-btn {
        width: 20px;
        height: 20px;
        font-size: 8px;
    }
    
    .spinner {
        width: 12px;
        height: 12px;
    }
    
    /* جعل الرسالة أقل عرضاً على الشاشات الصغيرة جداً */
    .alert-message.success,
    .alert-message.error {
        max-width: 100%;
    }
}