/**
 * GreenPulse Modal Base Styles
 * Tailwind CSS + Custom Modal Utilities
 */

/* Modal backdrop overlay */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: opacity 0.3s ease;
}

/* Modal container */
.modal-container {
    position: fixed;
    inset: 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

/* Modal dialog */
.modal-dialog {
    position: relative;
    width: 100%;
    max-width: 32rem; /* 512px */
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(1);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Modal sizes */
.modal-sm .modal-dialog {
    max-width: 24rem; /* 384px */
}

.modal-lg .modal-dialog {
    max-width: 48rem; /* 768px */
}

.modal-xl .modal-dialog {
    max-width: 64rem; /* 1024px */
}

.modal-full .modal-dialog {
    max-width: 90vw;
    max-height: 90vh;
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    border: none;
    background-color: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.modal-close:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.modal-close:focus {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

/* Modal body */
.modal-body {
    padding: 1.5rem;
    color: #374151;
}

/* Modal footer */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

/* Animation classes */
.modal-fade-enter {
    opacity: 0;
    transform: scale(0.95);
}

.modal-fade-enter-active {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.modal-fade-exit {
    opacity: 1;
    transform: scale(1);
}

.modal-fade-exit-active {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Hidden state */
.modal-container.hidden {
    display: none;
}

/* Scrollable modal body */
.modal-body-scrollable {
    max-height: 60vh;
    overflow-y: auto;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .modal-dialog {
        background-color: #1f2937;
    }

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

    .modal-title {
        color: #f9fafb;
    }

    .modal-body {
        color: #d1d5db;
    }

    .modal-close {
        color: #9ca3af;
    }

    .modal-close:hover {
        background-color: #374151;
        color: #f9fafb;
    }
}

/* Accessibility */
[role="dialog"] {
    outline: none;
}

/* Prevent scroll on body when modal is open */
body.modal-open {
    overflow: hidden;
}
