/* Modal Component Styles */
:root {
    --modal-backdrop-color: rgba(0, 0, 0, 0.5);
    --modal-background-color: #ffffff;
    --modal-border-radius: 20px;
    --modal-box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    --modal-header-border-color: #eaeaea;
    --modal-footer-border-color: #eaeaea;
    --modal-animation-duration: 300ms;
    --modal-backdrop-blur: 5px;

    --modal-btn-dark-bg: var(--btn-dark-background-color);
    --modal-btn-dark-hover-bg: var(--btn-dark-hover-background-color);
    --modal-btn-dark-box-shadow: var(--btn-dark-box-shadow);
    --modal-btn-light-bg: var(--btn-light-background-color);
    --modal-btn-light-border: var(--btn-light-border-color);
    --modal-btn-light-hover-bg: var(--btn-light-hover-background-color);
    --modal-btn-light-hover-border: var(--btn-light-hover-border-color);
}

/* Backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-backdrop-color);
    z-index: 1000;
    opacity: 0;
    transition: opacity var(--modal-animation-duration) ease-in-out, backdrop-filter var(--modal-animation-duration) ease-in-out;
    backdrop-filter: blur(0);
}

.modal-backdrop.active {
    opacity: 1;
    backdrop-filter: blur(var(--modal-backdrop-blur));
}

/* Modal Container */
.modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background-color: transparent;
    border-radius: var(--modal-border-radius);
    z-index: 1001;
    opacity: 0;
    transition: opacity var(--modal-animation-duration) ease-in-out,
        transform var(--modal-animation-duration) ease-in-out;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 320px;
    max-width: 95%;
    box-shadow: none;
}

.modal-container.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Modal Sizes */
.modal-small {
    width: 380px;
}

.modal-medium {
    width: 500px;
}

.modal-large {
    width: 700px;
}

/* Custom width classes for more flexibility */
.modal-width-auto {
    width: auto;
}

.modal-width-full {
    width: 95%;
}

/* Modal Content */
.modal-content {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    height: 100%;
    width: 100%;
    background-color: var(--modal-background-color);
    border-radius: var(--modal-border-radius);
    box-shadow: var(--modal-box-shadow);
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--modal-header-border-color);
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: var(--content-title-font-weight, 600);
    color: var(--content-title-color, #151717);
    font-family: var(--font-family, 'Poppins', sans-serif);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    transition: color 0.2s ease, background-color 0.2s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
    margin-left: 10px;
}

.modal-close:hover {
    color: #333;
    background-color: rgba(0, 0, 0, 0.05);
}

/* Corner Close Button */
.modal-corner-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 10;
}

.modal-corner-close:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #333;
}

/* Hide the corner close button when not closable */
.modal-not-closable .modal-corner-close,
.modal-not-closable .modal-close {
    display: none;
}

/* Modal Body */
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 0 1 auto;
    min-height: 50px;
    max-height: 60vh;
    font-family: var(--font-family, 'Poppins', sans-serif);
    scrollbar-width: thin;
    scrollbar-color: #8888886b transparent;
}

/* Modal Footer */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid var(--modal-footer-border-color);
}

/* Modal Buttons */
.modal-btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-family, 'Poppins', sans-serif);
}

.modal-btn-dark {
    background-color: var(--modal-btn-dark-bg);
    color: white;
    border: none;
    box-shadow: var(--modal-btn-dark-box-shadow);
}

.modal-btn-dark:hover {
    background-color: var(--modal-btn-dark-hover-bg);
}

.modal-btn-light {
    background-color: var(--modal-btn-light-bg);
    color: #212529;
    border: 1px solid var(--modal-btn-light-border);
}

.modal-btn-light:hover {
    background-color: var(--modal-btn-light-hover-bg);
    border-color: var(--modal-btn-light-hover-border);
}

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

.modal-btn-danger:hover {
    background-color: #bb2d3b;
}

.modal-btn-success {
    background-color: #198754;
    color: white;
    border: none;
}

.modal-btn-success:hover {
    background-color: #157347;
}

.modal-animation-slide {
    transform: translate(-50%, -60%) scale(1);
}

.modal-animation-slide.active {
    transform: translate(-50%, -50%) scale(1);
}

.modal-animation-zoom {
    transform: translate(-50%, -50%) scale(0.7);
}

.modal-animation-zoom.active {
    transform: translate(-50%, -50%) scale(1);
}

/* Custom scrollbar for modal body */
.modal-body::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #8888886b;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Responsive adjustments */
@media (max-width: 850px) {
    .modal-large {
        width: 90%;
    }
}

@media (max-width: 650px) {
    .modal-medium {
        width: 90%;
    }
}

@media (max-width: 450px) {
    .modal-small {
        width: 90%;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
    }
}