/* Modern Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-end;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0px;
    box-sizing: border-box;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: none;
    overflow-y: auto;
    position: relative;
    transform: translateY(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    outline: none;
    padding: 24px 22px 26px;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 16px;
    border-bottom: 1px solid #f3f4f6;
}

.modal-title {
    color: #ffffff;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f9fafb;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.close-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Modal Body */
.modal-body {
    padding: 20px 24px 24px;
}

/* Car Image */
.car-image-container {
    text-align: center;
    margin: 20px 0;
}

.car-image {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 12px;
    padding: 16px;
}

/* Description */
.modal-description {
    text-align: center;
    color: #6b7280;
    font-size: 16px;
    line-height: 1.5;
    margin: 16px 0 24px;
}

/* Action Buttons */
.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.action-btn {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
    font-family: inherit;
    font-size: 15px;
}

.action-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

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

.action-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-color: #3b82f6;
}

.action-btn.primary {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.action-btn.primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.action-btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    font-size: 18px;
}

.action-btn-content {
    flex: 1;
}

.action-btn-title {
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

.action-btn.primary .action-btn-title {
    color: white;
}

.action-btn-subtitle {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.4;
}

.action-btn.primary .action-btn-subtitle {
    color: rgba(255, 255, 255, 0.8);
}

/* Language Toggle */
.lang-toggle-container {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 20px 0;
}

.lang-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 20px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.lang-toggle-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.lang-toggle-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.lang-toggle-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Privacy Note */
.privacy-note {
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
    line-height: 1.4;
    margin: 20px 0 0;
}

/* RTL Support */
[dir="rtl"] .modal {
    text-align: right;
}

[dir="rtl"] .action-btn {
    text-align: right;
}

[dir="rtl"] .action-btn-icon {
    margin-right: 0;
    margin-left: 16px;
}

[dir="rtl"] .lang-toggle-container {
    direction: ltr;
}

/* Responsive Design */
@media (max-width: 640px) {
    .modal-overlay {
        padding: 16px;
    }
    
    .modal {
        max-width: 100%;
        border-radius: 16px;
    }
    
    .modal-header {
        padding: 20px 20px 12px;
    }
    
    .modal-body {
        padding: 16px 20px 20px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .action-btn {
        padding: 14px 16px;
        font-size: 14px;
    }
    
    .action-btn-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
        margin-right: 12px;
    }
    
    [dir="rtl"] .action-btn-icon {
        margin-right: 0;
        margin-left: 12px;
    }
    
    .car-image {
        width: 100px;
        height: 100px;
    }
}

/* Animation for modal entrance */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-overlay.active .modal {
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus styles for accessibility */
.modal:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Loading state */
.modal.loading .modal-body {
    opacity: 0.6;
    pointer-events: none;
}

/* Success state */
.modal.success .action-btn.primary {
    background: #10b981;
    border-color: #10b981;
}

.modal.success .action-btn.primary:hover {
    background: #059669;
    border-color: #059669;
}

/* Form Input Styling */
.form-group {
    margin-bottom: 16px;
}

.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
    font-size: 14px;
}

.input-wrapper {
    position: relative;
}

.input-flag {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 16px;
    color: #6b7280;
    opacity: 0.8;
    z-index: 2;
}

.activation-input,
.form-input {
    width: 95%;
    padding: 12px 40px 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    font-size: 16px;
    font-family: inherit;
    background: #ffffff;
    color: #111827;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.activation-input:focus,
.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.activation-input.invalid,
.form-input.invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.activation-input::placeholder,
.form-input::placeholder {
    color: #9ca3af;
}

/* Fix SVG blocking button clicks */
.activation-btn svg {
    pointer-events: none;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #ffffff;
    cursor: pointer;
}

.activation-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    cursor: pointer;
}

.flutter-modal-content.safe-area-padding {
    padding: 25px;
}

/* Blood Type Grid */
.blood-type-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 8px;
    margin-left: 20px;
    margin-right: 20px;
}

.blood-type-option {
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
    color: #374151;
}

.blood-type-option:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.blood-type-option.selected {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #1d4ed8;
}

/* Button Styling */
.activation-btn {
    font-family: 'Alexandria', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important; 
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.activation-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.activation-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* OTP Input Styling */
.otp-container {
    text-align: center;
    margin: 20px 0;
}

.otp-sent-message {
    font-size: 16px;
    color: #374151;
    margin-bottom: 20px;
}

.otp-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}

.otp-input {
    width: 48px;
    height: 48px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    background: #ffffff;
    transition: all 0.2s ease;
}

.otp-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.countdown {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 16px;
}

.otp-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Error Message Styling */
.error-message {
    color: #ef4444;
    font-size: 14px;
    margin-top: 8px;
    text-align: center;
}

/* OTP Modal Styling */
.otp-section {
    text-align: center;
}

.otp-title {
    font-size: 20px;
    margin-bottom: 10px;
    color: #FFEB3B;
}

.otp-description {
    font-size: 14px;
    color: #ffffff;
    margin-bottom: 20px;
}

.otp-input-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    direction: ltr;
}

.otp-input {
    width: 40px;
    height: 40px;
    text-align: center;
    font-size: 18px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.3s;
}

.otp-input:focus {
    border-color: #51cf66;
    outline: none;
}

.otp-input.active {
    border-color: #51cf66;
}

.otp-actions {
    display: grid;
    gap: 10px;
    justify-content: center;
}

.otp-actions .activation-btn {
    padding: 10px 20px;
    font-size: 16px;
    width: 100%;
    max-width: 200px;
}

.otp-actions .resend-btn {
    background: none;
    border: none;
    color: #ffffff;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-top: 10px;
}

/* Responsive Form Adjustments */
@media (max-width: 640px) {
    .activation-input,
    .form-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .blood-type-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .blood-type-option {
        padding: 12px 8px;
        font-size: 13px;
    }

    .otp-inputs {
        gap: 6px;
    }

    .otp-input {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}
