/* ========================================
   Rihla Tunis - Styles
   رحلة تونس - الأنماط
   ======================================== */

/* ===== الحاوية الرئيسية ===== */
.rihla-box {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 1000px;
    margin: 18px auto;
}

/* ===== الرسائل ===== */
#rihla-message {
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-weight: 700;
    display: none;
}

#rihla-message.success {
    display: block;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#rihla-message.error {
    display: block;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

#rihla-message.info {
    display: block;
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ===== قسم اختيار نوع العامل ===== */
.rihla-worker-type-section {
    background: #f0f7ff;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #0073aa;
}

.rihla-worker-type-section h4 {
    color: #0073aa;
    text-align: center;
    margin-bottom: 15px;
}

.rihla-worker-type-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.rihla-worker-type-option:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #0073aa;
}

.rihla-worker-type-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.rihla-worker-type-option input[type="radio"]:checked + span {
    color: #0073aa;
    font-weight: 700;
}

/* ===== أقسام العمال ===== */
.worker-section {
    margin-bottom: 20px;
}

.worker-section h3 {
    text-align: center;
    margin-bottom: 15px;
}

/* ===== حقل البحث ===== */
.rihla-search-container {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.rihla-search-box {
    display: flex;
    gap: 10px;
    background: white;
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex-wrap: wrap;
    justify-content: center;
}

.rihla-search-box input {
    width: 250px;
    height: 45px;
    border-radius: 25px;
    border: 1px solid #ddd;
    padding: 0 15px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
}

.rihla-search-box input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.2);
}

.rihla-search-box button {
    height: 45px;
    border-radius: 25px;
    padding: 0 25px;
    background: #0073aa;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s ease;
}

.rihla-search-box button:hover {
    background: #005a87;
}

/* ===== نموذج الإدخال اليدوي ===== */
.rihla-manual-form-card {
    background: #e8f5e9;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #28a745;
}

.rihla-manual-form-card .form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

/* ===== بطاقة معلومات الموظف ===== */
.rihla-employee-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border: 1px solid #e0e0e0;
}

.rihla-employee-card h4 {
    color: #0073aa;
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.rihla-employee-info-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.rihla-info-item {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 6px;
    border-right: 3px solid #0073aa;
}

.rihla-info-item strong {
    color: #0073aa;
    display: inline-block;
    min-width: 80px;
    font-size: 14px;
}

.rihla-info-item span {
    font-size: 14px;
    color: #333;
}

/* ===== حاويات النموذج ===== */
.rihla-companions-wrapper {
    background: #f5f5f5;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
}

.rihla-companions-wrapper h5 {
    color: #0073aa;
    margin-bottom: 20px;
    border-right: 3px solid #0073aa;
    padding-right: 10px;
}

.rihla-companion-row {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    align-items: center;
    background: white;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.rihla-companion-row .companion-label {
    min-width: 70px;
    font-weight: bold;
    color: #0073aa;
}

.rihla-companion-row .companion-field {
    flex: 1;
    min-width: 120px;
}

/* ===== حقول الإدخال الموحدة ===== */
.rihla-form-control,
.rihla-search-box input,
.rihla-search-box button,
#rihla-dt-enreg,
.rihla-companion-row input,
.rihla-companion-row select {
    height: 38px !important;
    line-height: 1.5 !important;
    padding: 6px 12px !important;
    border-radius: 5px;
    border: 1px solid #ddd;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

.rihla-form-control:focus,
.rihla-companion-row input:focus,
.rihla-companion-row select:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.2);
}

/* ===== الوجهة الثابتة ===== */
.rihla-destination-fixed {
    background: #f8f9fa !important;
    font-weight: bold !important;
    color: #0073aa !important;
    cursor: default;
}

/* ===== زر التسجيل ===== */
.rihla-btn-success {
    padding: 12px 40px;
    font-size: 18px;
    border-radius: 30px;
    background: #28a745;
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
}

.rihla-btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.rihla-btn-success:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== رسالة عدد المسجلين ===== */
#group-registration-message {
    display: none;
    margin: 15px 0;
    padding: 15px;
    background: linear-gradient(135deg, #e8f4fd 0%, #d1ecf1 100%);
    border: 1px solid #0073aa;
    border-radius: 10px;
    color: #0d47a1;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
}

/* ===== حاوية الاتصال ===== */
.rihla-contact-wrapper {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid #e0e0e0;
}

.rihla-contact-wrapper h5 {
    color: #0073aa;
    margin-bottom: 20px;
    border-right: 3px solid #0073aa;
    padding-right: 10px;
}

/* ===== تفاصيل التنبيه ===== */
.rihla-alert-details {
    background: #fff3cd;
    padding: 15px;
    color: #856404;
}

.rihla-alert-details ul {
    margin: 5px 0 0 20px;
}

.rihla-alert-details li {
    margin-bottom: 5px;
}

/* ===== المودال ===== */
.rihla-modal .modal-content {
    direction: rtl;
    text-align: right;
}

.rihla-modal .modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 20px;
}

.rihla-modal .modal-title {
    text-align: center;
    flex: 1;
    font-size: 1.25rem;
    font-weight: bold;
}

.rihla-modal .btn-close {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
}

.rihla-modal .modal-body {
    max-height: 400px;
    overflow-y: auto;
    padding: 20px;
}

.rihla-modal .modal-footer {
    border-top: 2px solid #dee2e6;
    padding: 15px;
}

/* ===== استجابة للشاشات الصغيرة ===== */
@media (max-width: 768px) {
    .rihla-box {
        padding: 10px;
    }

    .rihla-search-box {
        flex-direction: column;
        align-items: center;
        border-radius: 15px;
        padding: 15px;
    }

    .rihla-search-box input {
        width: 100%;
        max-width: 300px;
    }

    .rihla-search-box button {
        width: 100%;
        max-width: 300px;
    }

    .rihla-employee-info-container {
        grid-template-columns: 1fr;
    }

    .rihla-companion-row {
        flex-direction: column;
        align-items: stretch;
    }

    .rihla-companion-row .companion-label {
        min-width: auto;
        text-align: center;
    }

    .rihla-worker-type-option {
        padding: 8px 15px;
        font-size: 14px;
    }

    .rihla-btn-success {
        width: 100%;
        padding: 12px 20px;
        font-size: 16px;
    }

    .rihla-modal .modal-dialog {
        margin: 10px;
        width: 95%;
    }
}

@media (max-width: 480px) {
    .rihla-worker-type-section {
        padding: 10px;
    }

    .rihla-worker-type-option {
        padding: 6px 12px;
        font-size: 13px;
    }

    .rihla-search-box input {
        font-size: 14px;
    }

    .rihla-form-control {
        font-size: 13px;
    }
}

/* ===== إخفاء سهم التفاصيل في Edge ===== */
details summary::-webkit-details-marker {
    display: none;
}

details[open] summary span:last-child {
    transform: rotate(180deg);
}

details summary span:last-child {
    transition: transform 0.3s ease;
}

/* ===== أزرار التنبيه ===== */
.rihla-notice {
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.rihla-notice-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.rihla-notice-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.rihla-notice-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.rihla-notice-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* ===== تنسيق المودال Bootstrap ===== */
.modal-backdrop {
    display: none !important;
}

.modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.modal.show .modal-dialog {
    transform: none !important;
}

/* ===== تنسيق الجداول في المودال ===== */
.rihla-modal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.rihla-modal-table th {
    background: #343a40;
    color: white;
    padding: 8px;
    text-align: center;
    border: 1px solid #454d55;
}

.rihla-modal-table td {
    padding: 8px;
    text-align: center;
    border: 1px solid #dee2e6;
}

.rihla-modal-table tr:nth-child(even) {
    background: #f8f9fa;
}

/* ===== معلومات الموظف ===== */
#rihla-employee-card {
    display: none;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border: 1px solid #e0e0e0;
}

#rihla-employee-card h4 {
    color: #0073aa;
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

#rihla-employee-info-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.rihla-info-item {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 6px;
    border-right: 3px solid #0073aa;
}

.rihla-info-item strong {
    color: #0073aa;
    display: inline-block;
    min-width: 80px;
    font-size: 14px;
}

.rihla-info-item span {
    font-size: 14px;
    color: #333;
}

/* ===== نموذج التسجيل ===== */
#rihla-registration-form-container {
    display: none;
}

/* ===== رسالة النتيجة ===== */
#rihla-message {
    display: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 700;
    text-align: center;
    margin-top: 15px;
    transition: all 0.3s ease;
}

#rihla-message.success {
    display: block;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#rihla-message.error {
    display: block;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

#rihla-message.info {
    display: block;
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

#rihla-message.warning {
    display: block;
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* ===== التحقق من صحة الحقول ===== */
.is-invalid {
    border-color: #dc3545 !important;
    background-color: #fff8f8 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25) !important;
}

.is-valid {
    border-color: #28a745 !important;
    background-color: #f8fff8 !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.25) !important;
}

.national-id-hint {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.national-id-hint.error {
    color: #dc3545;
}

.national-id-hint.success {
    color: #28a745;
}

/* ===== تنسيق حقل رقم التعريف الوطني ===== */
#rihla-manual-national_id,
#admin-manual-national_id {
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
}

#rihla-manual-national_id:focus,
#admin-manual-national_id:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.2);
}

#rihla-manual-national_id.is-valid,
#admin-manual-national_id.is-valid {
    border-color: #28a745;
    background-color: #f8fff8;
}

#rihla-manual-national_id.is-invalid,
#admin-manual-national_id.is-invalid {
    border-color: #dc3545;
    background-color: #fff8f8;
}

/* ===== تنسيق رسائل المساعدة ===== */
.national-id-hint {
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}

.national-id-hint.success {
    color: #28a745;
}

.national-id-hint.error {
    color: #dc3545;
}

@media (max-width: 768px) {
    #rihla-manual-national_id,
    #admin-manual-national_id {
        font-size: 16px !important;
        height: 40px !important;
    }
    
    .rihla-manual-grid,
    .admin-manual-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ===== إخفاء قسم اختيار نوع العامل في Frontend ===== */
.rihla-worker-type-section {
    display: none !important;
}