/* Modal System Styles */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.modal {
    position: fixed;
  /*  left: 50%;
    top: 50%;
    transform: translate(-50%, -50%); */
   
    min-width: 300px;
    max-width: 1300px;
    height: 500px;
    width: 64%;
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 10001;
}

.modal.active {
    transform: scale(1);
    opacity: 1;
    display: flex;
}

.modal.closing {
    transform: scale(0.9);
    opacity: 0;
}

/* When modal is being dragged, remove transform to prevent jumping */
.modal.dragging {
    opacity: 0.6;
    cursor: grabbing;
    transform: none !important;
    transition: none !important;
     
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
  /*  background: linear-gradient(135deg, var(--bg-modal-header-start) 0%, var(--bg-modal-header-end) 100%); */
    background: linear-gradient(135deg, var(--primary-dark) 30%,  var(--primary-darker) 100%);
    border-bottom: 1px solid var(--border);
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    flex-shrink: 0;
}

.modal-header i {
    font-size: 30px;
    margin-right: 0px;
    color: var(--text-secondary);
}

.modal-title {
    margin: 0;
    color: var(--text);
    font-size: 24px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.modal-close:hover {
    background-color: var(--surface-hover);
    color: var(--text);
}

.modal-close:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Modal Body */
.modal-body {
    display: flex;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-light) 100%);
}

/* Scrollbar Styling */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background-color: var(--surface-light);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 4px;
    border: 2px solid var(--surface-light);
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-hover);
}

.modal-body {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--surface-light);
}

/* Modal Footer */
.modal-footer {
  
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-light) 100%);
    gap: 1rem;
}

.modal-footer .btn {
    flex: 1;
    justify-content: center;
    min-width: 80px;
    min-height: 46px
}

/* Modal Animations */
.modal.fade-in {
    animation: modalFadeIn 0.3s ease forwards;
}

.modal.fade-out {
    animation: modalFadeOut 0.3s ease forwards;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* Modal Actions */
.modal-actions {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.modal-actions .btn {
    flex: 1;
    min-width: auto;
}

/* ==================== INFO MODAL STYLES ==================== */

/* Info Modal Variants */
.modal.info-modal {
    border-top: 2px solid var(--info);
}

.modal.info-modal .modal-header {
    background: linear-gradient(135deg, var(--bg-info-modal-header-start) 0%, var(--bg-info-modal-header-end) 100%);
}

.modal.info-modal .modal-title {
    color: var(--info);
}



/* Success Modal */
.modal.success-modal {
    border-top: 2px solid var(--success);
}

.modal.success-modal .modal-header {
   /* background: linear-gradient(135deg, rgba(81, 207, 102, 0.1) 0%, var(--surface) 100%); */
   background: linear-gradient(135deg, var(--bg-success-modal-header-start) 0%, var(--bg-success-modal-header-end) 100%);
}

.modal.success-modal .modal-title {
    color: var(--success);
}


/* Warning Modal */
.modal.warning-modal {
    border-top: 2px solid var(--warning);
}

.modal.warning-modal .modal-header {
   /* background: linear-gradient(135deg, rgba(255, 217, 61, 0.1) 0%, var(--surface) 100%); */
    background: linear-gradient(135deg, var(--bg-warning-modal-header-start) 0%, var(--bg-warning-modal-header-end) 100%); 
}

.modal.warning-modal .modal-title {
    color: var(--warning);
}

/* Error Modal */
.modal.error-modal {
    border-top: 2px solid var(--danger);
}

.modal.error-modal .modal-header {
   /* background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, var(--surface) 100%); */
   background: linear-gradient(135deg, var(--bg-error-modal-header-start) 0%, var(--bg-error-modal-header-end) 100%);
}

.modal.error-modal .modal-title {
    color: var(--danger);
}


/* Info Modal Content */
.info-modal-content {
    text-align: center;
    padding: 1rem;
}

.info-modal-icon {
    margin-bottom: 1.5rem;
}

.info-modal-icon i {
    font-size: 64px;
}

.info-modal-body {
    color: var(--text);
    line-height: 1.6;
    font-size: 1rem;
}



/* Dragging State */
.modal.dragging {
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Animation Classes */
.modal.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

.modal.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
}

/* Modals Forms styles */
.modal-large {
    height: 640px;
}


/* Form Labels in Modal */
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Input Wrapper in Modal */
.input-wrapper {
    position: relative;
}

/* Modal Form Input */

#forgotPasswordForm, #sendEmailForm {
    width: 100%;
}


.modal-data {
    position: relative;
    z-index: 100004;
    width: 84%;
    
    left: 00%;
}

.modal-icon {
    position: absolute;
    z-index: 100003;
    width: 100%;
    left: 0px;
    text-align:right;
    padding-right: 32px;
}

.modal-icon i {
    font-size: 300px;
     color:rgba(0, 0, 0, 0.2);
}


#forgotPasswordForm .form-input,
#sendEmailForm .form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

#forgotPasswordForm .form-input:focus,
#sendEmailForm .form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

#forgotPasswordForm .form-input::placeholder,
#sendEmailForm .form-input::placeholder {
    color: var(--text-muted);
}

/* Modal Form Textarea */
#sendEmailForm textarea.form-input {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    line-height: 1.5;
}

/* Modal Form Group */
#forgotPasswordForm .form-group {
    margin-bottom: 1.5rem;
}

#forgotPasswordForm .form-group:last-child {
    margin-bottom: 0;
}

/* Modal Error Message */
#forgotPasswordForm .error-message,
#sendEmailForm .error-message {
    position: absolute;
    bottom: -1.25rem;
    left: 0;
    font-size: 0.75rem;
    color: var(--danger);
    opacity: 0;
    transition: opacity 0.2s ease;
}

#forgotPasswordForm .error-message.show,
#sendEmailForm .error-message.show {
    opacity: 1;
}

/* Modal Form Input Error */
#forgotPasswordForm .form-input.error,
#sendEmailForm .form-input.error {
    border-color: var(--danger);
}



/* ==================== LOADING SPINNER ==================== */


.modal-loading p {
    color: var(--text);
    margin-top: 1rem;
}

/* Loading Spinner */
.modal-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    text-align: center;
    padding: 2rem;
}

.spinner {
    content: "";
    width: 340px;
    height: 340px;
    border: 3px solid rgba(244, 67, 54, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.loading-message {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 80%;
    height: 80%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.loading-message p {
                        color: var(--text);
                        font-size: 26px;
                   }

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Focus Styles */
.modal:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Accessibility */
.modal[aria-hidden="true"] {
    display: none;
}

.modal[aria-hidden="false"] {
    display: flex;
}

/* Button Transitions */
.modal-footer .btn {
    transition: background-color 0.3s ease;
}



/* Responsive Styles */
@media (max-width: 768px) {
    .modal {
        min-width: 280px;
        max-width: calc(100vw - 32px);
        max-height: 85vh;
        margin: 16px;
    }
    
    .modal-header {
        padding: 12px 16px;
        font-size: 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
    }
    
    .modal-footer .btn {
        flex: 1;
        min-width: auto;
    }
}



@media (max-width: 480px) {
    .modal {
        min-width: 260px;
        max-width: calc(100vw - 16px);
        margin: 8px;
        border-radius: 8px;
    }
    
    .modal-header {
        padding: 10px 12px;
        font-size: 16px;
        cursor: move;
    }
    
    .modal-title {
        font-size: 14px;
    }
}