/* ==========================================================================
   MODAL POPUP STYLES
   ========================================================================== */

/* Modal backdrop */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 15, 0.85);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    display: block;
    opacity: 1;
}

/* Modal container */
.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--forest-green);
    border: var(--border-heavy) solid var(--ink-black);
    z-index: 9999;
    padding: var(--space-2xl);
    box-shadow: 12px 12px 0 rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s ease;
}

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

/* Modal header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-lg);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 900;
    color: var(--paper-white);
    margin: 0;
    padding-right: var(--space-lg);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--paper-white);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.modal-close:hover {
    color: var(--accent-orange);
    transform: rotate(90deg);
}

/* Modal body */
.modal-body {
    color: var(--paper-white);
}

.modal-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: var(--space-xl);
    line-height: 1.6;
}

/* Modal form inherits from main form styles */
.modal .audit-form {
    padding: 0;
}

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

/* Mobile styles */
@media (max-width: 768px) {
    .modal {
        width: 95%;
        max-height: 85vh;
        padding: var(--space-xl) var(--space-lg);
    }

    .modal-title {
        font-size: 1.5rem;
        padding-right: var(--space-md);
    }

    .modal-close {
        width: 35px;
        height: 35px;
        font-size: 1.75rem;
    }

    .modal-subtitle {
        font-size: 0.95rem;
        margin-bottom: var(--space-lg);
    }
}

@media (max-width: 375px) {
    .modal {
        padding: var(--space-lg) var(--space-md);
    }

    .modal-title {
        font-size: 1.35rem;
    }
}
