@font-face {
    font-family: 'AlJazeeraArabicBold';
    src: url('../fonts/Al-Jazeera-Arabic-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

/* Base Arabic styling */
.card-arabic, .rtl-heading, .form-arabic, .rtl-fix, .form-check.rtl-fix label {
    font-family: 'AlJazeeraArabicBold', serif !important;
}

.card-arabic { 
    direction: rtl; 
    text-align: right; 
    font-size: 1.1rem; 
    line-height: 1.6; 
}

.rtl-heading {
    direction: rtl; 
    text-align: right; 
    color: #007bff;
    text-decoration: underline; 
    text-underline-offset: 4px; 
    text-decoration-thickness: 2px;
    text-shadow: 1px 1px 2px rgba(0,0,0,.2); 
    font-size: 1.5rem; 
    line-height: 1.6;
}

.form-floating.rtl-fix { 
    direction: rtl; 
    text-align: right; 
}

.form-floating.rtl-fix label { 
    right: .75rem; 
    left: auto; 
    text-align: right; 
}

/* RTL checkbox fix */
.form-check.rtl-right{
    direction: rtl;
    text-align: right;
    padding-right: 1.75rem;
    padding-left: 0 !important;
}

.form-check.rtl-right .form-check-input{
    float: right !important;
    margin-right: -1.75rem !important;
    margin-left: 0 !important;
}

.form-check.rtl-right .form-check-label{
    margin: 0;
    cursor: pointer;
    display: inline-block;
}

/* Validation Styles */
.was-validated .form-control:valid,
.was-validated .form-control:invalid {
    border-width: 2px;
}

.was-validated .form-control:valid,
.is-valid {
    border-color: #198754;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.was-validated .form-control:invalid,
.is-invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6.4.4.4-.4'/%3e%3cpath d='M6 7v2'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.invalid-feedback {
    display: none;
}

.was-validated .form-control:invalid ~ .invalid-feedback,
.form-control.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Real-time validation feedback */
.form-control:not(:placeholder-shown):valid {
    border-color: #198754;
}

.form-control:not(:placeholder-shown):invalid {
    border-color: #dc3545;
}

/* Phone input specific styling */
.phone-input,
input[type="tel"] {
    direction: ltr;
    text-align: left;
}

/* Form controls */
.form-select {
    background-position: left 0.75rem center;
}

.form-floating > .form-select {
    padding-right: 0.75rem;
    padding-left: 2.5rem;
}

select:disabled {
    opacity: 0.7;
    background-color: #f8f9fa;
}

/* Medical requirement alert */
.medical-required-alert {
    border-right: 4px solid #dc3545;
    background-color: #f8d7da;
    animation: pulse-alert 2s infinite;
}

/* Enhanced medical card styling */
.medical-status-badge {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    font-weight: 600;
}

.medical-action-buttons .btn {
    border-radius: 6px;
    font-weight: 600;
}

.medical-status-text {
    font-size: 0.85rem;
    font-weight: 500;
}

.status-progress .progress {
    height: 8px;
    border-radius: 4px;
}

/* Disabled form styles */
.form-disabled {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.form-disabled::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
    border-radius: 0.375rem;
}

.disabled-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
}

.disabled-message {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    max-width: 500px;
    margin: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.disabled-message .alert {
    margin-bottom: 1.5rem;
}

/* Fees styling */
.fees-list .fee-item {
    font-weight: 500;
    color: #333;
}

.fees-list .fee-amount {
    font-family: 'Courier New', monospace;
}

.total-label {
    color: #2c5aa0;
}

.total-amount {
    color: #dc3545 !important;
}

/* Payment methods card */
.payment-methods-card {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 15px;
    color: white;
}

/* Download app card */
.download-app-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    color: white;
    border: none;
}

.background-animation {
    z-index: 0;
}

.bubble-1 {
    top: 20%;
    left: 10%;
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.bubble-2 {
    top: 60%;
    right: 15%;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
    animation: float 4s ease-in-out infinite reverse;
}

/* Icon with pulse animation */
.icon-container {
    position: relative;
    display: inline-block;
}

.mobile-icon {
    animation: pulse 2s infinite;
    position: relative;
    z-index: 2;
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border: 2px solid rgba(255, 193, 7, 0.6);
    border-radius: 50%;
    animation: pulse 2s infinite;
    z-index: 1;
}

/* Enhanced Progress Bar Styles */
.upload-progress {
    display: none;
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.progress-container {
    position: relative;
    height: 25px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, 
        #4facfe 0%, 
        #00f2fe 25%, 
        #00f2fe 50%, 
        #4facfe 75%, 
        #4facfe 100%);
    background-size: 200% 100%;
    border-radius: 12px;
    transition: width 0.4s cubic-bezier(0.65, 0, 0.35, 1);
    position: relative;
    overflow: hidden;
    animation: shimmer 2s infinite linear;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%);
    animation: shine 1.5s infinite;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: 0.9rem;
    color: #666;
}

.progress-percentage {
    font-weight: bold;
    font-size: 1.1rem;
    color: #4facfe;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-text {
    font-weight: 500;
    color: #555;
}

.upload-status {
    text-align: center;
    margin-top: 15px;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.upload-status::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.1) 50%, 
        transparent 100%);
    animation: statusShine 3s infinite;
}

.upload-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 0.85rem;
    color: #777;
}

.upload-time, .upload-speed {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Button hover effects */
.download-btn {
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    border-color: #fff;
}

.download-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.download-btn:hover::before {
    left: 100%;
}

/* Loading spinner for submit button */
.btn-loading {
    position: relative;
    overflow: hidden;
}

.btn-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 50%, 
        transparent 100%);
    animation: buttonShine 1.5s infinite;
}

.btn-loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

/* Animations */
@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

@keyframes pulse {
    0% { 
        transform: scale(1); 
        box-shadow: 0 0 0 0 rgba(25, 135, 84, 0.7); 
    }
    70% { 
        transform: scale(1.05); 
        box-shadow: 0 0 0 10px rgba(25, 135, 84, 0); 
    }
    100% { 
        transform: scale(1); 
        box-shadow: 0 0 0 0 rgba(25, 135, 84, 0); 
    }
}

@keyframes pulse-alert {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes statusShine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

@keyframes buttonShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* File upload icons */
.upload-icon {
    font-size: 1.2rem;
    margin-right: 8px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-3px); }
}

/* Success state */
.progress-bar.success {
    background: linear-gradient(90deg, #28a745, #20c997);
    animation: none;
}

.upload-status.success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

/* Error state */
.progress-bar.error {
    background: linear-gradient(90deg, #dc3545, #e83e8c);
    animation: none;
}

.upload-status.error {
    background: linear-gradient(135deg, #dc3545 0%, #e83e8c 100%);
}

/* Utility classes */
.hint { 
    color:#6c757d;
    font-size:.875rem; 
}

.hidden { 
    display:none !important; 
}

/* Responsive design improvements */
@media (max-width: 768px) {
    .card-arabic {
        font-size: 1rem;
        padding: 1rem !important;
    }
    
    .rtl-heading {
        font-size: 1.3rem;
    }
    
    .medical-status-text {
        font-size: 0.8rem !important;
    }
    
    .upload-progress {
        padding: 15px;
        margin-top: 15px;
    }
    
    .progress-container {
        height: 20px;
    }
    
    .progress-stats {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .upload-details {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .fees-list .fee-item {
        font-size: 0.9rem;
    }
    
    .fees-list .fee-amount {
        font-size: 0.9rem;
    }
    
    .total-label,
    .total-amount {
        font-size: 1.1rem !important;
    }
    
    .icon-container .mobile-icon {
        font-size: 2.5rem !important;
    }
    
    .pulse-ring {
        width: 60px;
        height: 60px;
    }
    
    h4 {
        font-size: 1.3rem;
    }
}

@media (max-width: 576px) {
    .card-body {
        padding: 1rem;
    }
    
    .btn-sm {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .form-floating {
        margin-bottom: 1rem;
    }
    
    .fees-list .fee-item {
        font-size: 0.8rem;
    }
    
    .fees-list .fee-amount {
        font-size: 0.8rem;
    }
    
    .total-label,
    .total-amount {
        font-size: 1rem !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .upload-progress {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        border-color: #4a5568;
    }
    
    .progress-container {
        background: #1a202c;
        border-color: #4a5568;
    }
}