/**
 * MEDRS UI Components Styles
 * 
 * Modern, elegant styles for UI components library
 * Replaces browser dialogs with beautiful in-page modals
 */

/* ========================================================================
   LOADING OVERLAY
   ======================================================================== */

.ui-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.ui-loading-content {
    background: white;
    padding: 2rem 3rem;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 250px;
    animation: slideUp 0.3s ease-out;
}

.ui-loading-content .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

.ui-loading-content p {
    color: #334155;
    font-size: 1.125rem;
    font-weight: 500;
    margin: 0;
}

/* ========================================================================
   ENHANCED MODAL ANIMATIONS
   ======================================================================== */

.modal.fade .modal-dialog {
    transform: scale(0.9) translateY(-50px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.show .modal-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Modal with success/danger indicators */
.modal-header .bi-check-circle {
    font-size: 1.5rem;
    animation: successPulse 0.6s ease-out;
}

.modal-header .bi-exclamation-triangle {
    font-size: 1.5rem;
    animation: warningShake 0.5s ease-out;
}

/* ========================================================================
   ENHANCED TOAST STYLES (Bootstrap 5 Override)
   ======================================================================== */

#ui-toast-container {
    z-index: 9999;
    max-width: 400px;
}

#ui-toast-container .toast {
    margin-bottom: 12px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 
                0 5px 10px rgba(0, 0, 0, 0.1);
    border: none;
    overflow: hidden;
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#ui-toast-container .toast.hide {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#ui-toast-container .toast .toast-body {
    padding: 1rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
}

#ui-toast-container .toast .btn-close {
    padding: 1rem;
}

/* Success Toast */
#ui-toast-container .toast.bg-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
}

/* Danger/Error Toast */
#ui-toast-container .toast.bg-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
}

/* Warning Toast */
#ui-toast-container .toast.bg-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #ffffff !important;
}

/* Info Toast */
#ui-toast-container .toast.bg-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
}

/* Toast Icon Styles */
#ui-toast-container .toast .bi {
    font-size: 1.125rem;
    vertical-align: middle;
}

/* ========================================================================
   PROGRESS MODAL
   ======================================================================== */

#ui-progress-modal .progress {
    height: 30px;
    background-color: #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

#ui-progress-modal .progress-bar {
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    transition: width 0.4s ease-out;
}

.modal-body {

    background-color: #ffffff;

}

.modal-content {

    color: #000000;

}

#ui-progress-modal .modal-body p {
    font-size: 1rem;
    color: #000000;
}

/* ========================================================================
   SUCCESS MODAL (Checkmark Animation)
   ======================================================================== */

.modal .bi-check-circle-fill {
    animation: successCheckmark 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================================================
   ENHANCED BUTTON STATES
   ======================================================================== */

.modal .btn {
    font-weight: 500;
    padding: 0.625rem 1.5rem;
    transition: all 0.2s ease-out;
    border-radius: 6px;
}

.modal .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.modal .btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
}

.modal .btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.modal .btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: none;
}

.modal .btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.modal .btn-secondary {
    background: #e5e7eb;
    border: none;
    color: #1f2937;
}

.modal .btn-secondary:hover {
    background: #d1d5db;
    color: #111827;
}

/* ========================================================================
   FORM INPUT ENHANCEMENTS (for prompts)
   ======================================================================== */

.modal .form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.15);
}

.modal .invalid-feedback {
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* ========================================================================
   ANIMATIONS
   ======================================================================== */

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

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes successPulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes successCheckmark {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes warningShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* ========================================================================
   RESPONSIVE ADJUSTMENTS
   ======================================================================== */

@media (max-width: 576px) {
    #ui-toast-container {
        left: 1rem;
        right: 1rem;
        top: 1rem;
        max-width: none;
    }

    #ui-toast-container .toast {
        width: 100%;
    }

    .ui-loading-content {
        padding: 1.5rem 2rem;
        min-width: 200px;
    }

    .modal .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* ========================================================================
   ACCESSIBILITY ENHANCEMENTS
   ======================================================================== */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .modal {
        border: 2px solid currentColor;
    }

    .toast {
        border: 2px solid currentColor;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .modal.fade .modal-dialog,
    .toast,
    .ui-loading-overlay,
    .ui-loading-content,
    .btn,
    .modal .bi-check-circle-fill {
        animation: none !important;
        transition: none !important;
    }
}

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

/* ========================================================================
   DARK MODE SUPPORT (future-ready)
   ======================================================================== */

@media (prefers-color-scheme: dark) {
    .ui-loading-content {
        background: #1f2937;
        color: #f3f4f6;
    }

    .ui-loading-content p {
        color: #e5e7eb;
    }

    .modal-content {
        background: #374860;
        color: #000000;
    }

    .modal-header {
        border-bottom-color: #374151;
    }

    .modal-footer {
        border-top-color: #374151;
    }

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

    .btn-secondary:hover {
        background: #4b5563;
    }
}

/* ========================================================================
   UTILITY CLASSES
   ======================================================================== */

.ui-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.ui-slide-up {
    animation: slideUp 0.3s ease-out;
}

.ui-pulse {
    animation: successPulse 0.6s ease-out;
}

/* Loading spinner colors */
.spinner-border.text-primary {
    color: #3b82f6 !important;
}

/* ========================================================================
   PRINT STYLES
   ======================================================================== */

@media print {
    .ui-loading-overlay,
    #ui-toast-container,
    .modal-backdrop,
    .modal {
        display: none !important;
    }
}

