/**
 * Modal Component Styles
 * Styling for modal dialogs and popups
 */

/* Base Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1055;
    display: none;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 0.5rem;
    pointer-events: none;
}

.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
    transform: translate(0, -50px);
}

.modal.show .modal-dialog {
    transform: none;
}

.modal.modal-static .modal-dialog {
    transform: scale(1.02);
}

/* Modal Dialog Centered */
.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 1rem);
}

/* Modal Dialog Scrollable */
.modal-dialog-scrollable {
    height: calc(100% - 1rem);
}

.modal-dialog-scrollable .modal-content {
    max-height: 100%;
    overflow: hidden;
}

.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
}

/* Modal Content */
.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    outline: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Modal Header */
.modal-header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.modal-header .btn-close {
    padding: 0.625rem 0.625rem;
    margin: -0.625rem -0.625rem -0.625rem auto;
}

.modal-title {
    margin-bottom: 0;
    line-height: 1.5;
    font-weight: 600;
    color: #ffffff;
}

/* Modal Body */
.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1.5rem;
}

/* Modal Footer */
.modal-footer {
    display: flex;
    flex-wrap: wrap;
    flex-shrink: 0;
    align-items: center;
    justify-content: flex-end;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #e9ecef;
}

.modal-footer > * {
    margin: 0.25rem;
}

/* Modal Size Variants */
.modal-sm {
    max-width: 300px;
}

.modal-lg {
    max-width: 800px;
}

.modal-xl {
    max-width: 1140px;
}

/* Custom Modal Styling */
.modal-content {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border-radius: 10px;
}

.modal-header {
    border-bottom: 1px solid #eee;
    background-color: #fafafa;
}

.modal-header .close {
    padding: 0;
    margin: 0;
    opacity: 0.6;
    font-size: 1.75rem;
    transition: all 0.2s ease;
}

.modal-header .close:hover {
    opacity: 1;
}

.modal-title {
    font-weight: 600;
}

.modal-footer {
    border-top: 1px solid #eee;
    background-color: #fafafa;
}

/* Danger Modal */
.modal-danger .modal-header {
    background-color: #f8d7da;
    color: #721c24;
    border-bottom: none;
}

.modal-danger .modal-body {
    padding: 2rem;
    text-align: center;
}

.modal-danger .modal-footer {
    border-top: none;
    justify-content: center;
}

.warning-icon {
    text-align: center;
    color: #dc3545;
    margin-bottom: 1.5rem;
}

.warning-icon i {
    font-size: 3rem;
}

/* Success Modal */
.modal-success .modal-header {
    background-color: #d4edda;
    color: #155724;
    border-bottom: none;
}

.modal-success .modal-body {
    padding: 2rem;
    text-align: center;
}

.modal-success .modal-footer {
    border-top: none;
    justify-content: center;
}

.success-icon {
    text-align: center;
    color: #28a745;
    margin-bottom: 1.5rem;
}

.success-icon i {
    font-size: 3rem;
}

/* Info Modal */
.modal-info .modal-header {
    background-color: #d1ecf1;
    color: #0c5460;
    border-bottom: none;
}

/* Preview Modal for Products */
#previewModal .preview-price {
    font-size: 1.5rem;
    color: #3D7A67;
}

#previewModal .badge {
    background-color: #e0e0ff;
    color: #3D7A67;
    padding: 5px 10px;
    margin-right: 5px;
    margin-bottom: 5px;
}

/* Cart Confirm Dialog */
.custom-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-confirm-dialog {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 400px;
    overflow: hidden;
}

.custom-confirm-header {
    background-color: #f8f9fa;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-confirm-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.custom-confirm-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    color: #6c757d;
}

.custom-confirm-body {
    padding: 1rem;
    color: #212529;
}

.custom-confirm-footer {
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.custom-btn {
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    cursor: pointer;
    border: 1px solid transparent;
}

.custom-btn-secondary {
    background-color: #6c757d;
    color: white;
    border-color: #6c757d;
}

.custom-btn-danger {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* Account Deletion Modal */
.modal-account-delete .modal-body {
    text-align: center;
}

.modal-account-delete .warning-icon {
    margin-bottom: 2rem;
}

.modal-account-delete .modal-body ul {
    text-align: left;
    margin-bottom: 0;
    color: #666;
}

/* Image Preview Modal */
.image-preview-modal .modal-body {
    padding: 0;
    text-align: center;
}

.image-preview-modal img {
    max-width: 100%;
    max-height: 80vh;
}

/* Modal Animations */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal.show .modal-dialog {
    animation: modalFadeIn 0.3s ease-out;
}

/* Responsive Adjustments */
@media (min-width: 576px) {
    .modal-dialog {
        max-width: 500px;
        margin: 1.75rem auto;
    }

    .modal-dialog-scrollable {
        height: calc(100% - 3.5rem);
    }

    .modal-dialog-centered {
        min-height: calc(100% - 3.5rem);
    }

    .modal-sm {
        max-width: 300px;
    }
}

@media (min-width: 992px) {
    .modal-lg,
    .modal-xl {
        max-width: 800px;
    }
}

@media (min-width: 1200px) {
    .modal-xl {
        max-width: 1140px;
    }
}

@media (max-width: 576px) {
    .modal-body {
        padding: 1rem;
    }

    .modal-header,
    .modal-footer {
        padding: 1rem;
    }

    .warning-icon i,
    .success-icon i {
        font-size: 2.5rem;
    }

    .custom-confirm-dialog {
        max-width: 90%;
        margin: 0 10px;
    }
}