/**
 * Auto-Save Modal Styles
 * @package Advanced_Visa_Forms
 */

/* Modal Overlay */
.avf-restore-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: -webkit-fill-available; /* iOS Safari fallback */
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px); /* iOS Safari */
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: auto;
    -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
}

/* Modal Container */
.avf-restore-modal {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    animation: modalSlideIn 0.3s ease-out;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.avf-restore-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 24px;
    text-align: center;
    color: #ffffff;
}

.avf-restore-modal-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #ffffff !important;
}

/* Higher specificity to override global styles */
.avf-restore-modal-overlay .avf-restore-modal .avf-restore-modal-header h3 {
    color: #ffffff !important;
}

/* Even higher specificity */
.avf-restore-modal-overlay .avf-restore-modal-header h3[style] {
    color: #ffffff !important;
}

/* Maximum specificity to override any theme styles */
html body .avf-restore-modal-overlay .avf-restore-modal .avf-restore-modal-header h3,
html body .avf-restore-modal-overlay .avf-restore-modal .avf-restore-modal-header h3[style] {
    color: #ffffff !important;
    background: transparent !important;
}

/* Modal Body */
.avf-restore-modal-body {
    padding: 28px 24px;
    text-align: center;
    direction: rtl;
}

.avf-restore-modal-body p {
    margin: 0 0 16px 0;
    font-size: 16px;
    line-height: 1.6;
    color: #333333;
}

.avf-restore-modal-body p:last-child {
    margin-bottom: 0;
}

.avf-restore-modal-body p strong {
    color: #667eea;
    font-weight: 600;
}

.avf-restore-date {
    font-size: 14px;
    color: #666666;
    background: #f5f5f5;
    padding: 8px 12px;
    border-radius: 6px;
    display: inline-block;
}

/* Modal Footer */
.avf-restore-modal-footer {
    padding: 0 24px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-direction: row-reverse; /* RTL buttons */
}

/* Buttons */
.avf-btn {
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    outline: none;
    min-width: 160px;
    justify-content: center;
    flex-direction: row !important; /* Text first, then icon */
}

/* Text comes first in HTML and display */
.avf-btn-text {
    order: 1;
}

/* Icon comes second */
.avf-btn-icon {
    order: 2;
}

.avf-btn svg {
    width: 16px;
    height: 16px;
}

.avf-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.avf-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

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

.avf-btn-secondary {
    background: #ffffff;
    color: #666666;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.avf-btn-secondary:hover {
    background: #f8f8f8;
    border-color: #d0d0d0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

/* Notifications */
.avf-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ffffff;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 100000;
    min-width: 300px;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
    direction: rtl;
    border-right: 4px solid #667eea;
}

.avf-notification-show {
    transform: translateX(0);
    opacity: 1;
}

.avf-notification-success {
    border-right-color: #10b981;
}

.avf-notification-success .avf-notification-content::before {
    content: "✓ ";
    color: #10b981;
    font-weight: bold;
    margin-left: 8px;
}

.avf-notification-error {
    border-right-color: #ef4444;
}

.avf-notification-error .avf-notification-content::before {
    content: "✕ ";
    color: #ef4444;
    font-weight: bold;
    margin-left: 8px;
}

.avf-notification-content {
    display: flex;
    align-items: center;
}

.avf-notification-message {
    font-size: 15px;
    color: #333333;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .avf-restore-modal {
        max-width: 95%;
        margin: 20px;
    }

    .avf-restore-modal-header h3 {
        font-size: 20px;
    }

    .avf-restore-modal-body {
        padding: 20px 16px;
    }

    .avf-restore-modal-footer {
        flex-direction: column !important;
        padding: 0 16px 20px 16px;
        gap: 10px;
    }

    .avf-btn {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .avf-notification {
        right: 10px;
        left: 10px;
        min-width: 0;
    }
}

/* Accessibility */
.avf-btn:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

.avf-restore-modal-overlay:focus-within {
    outline: none;
}

/* Animation for overlay fade */
.avf-restore-modal-overlay {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
