/* Modal Styles for MDUC */

/* Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    box-sizing: border-box;
}

.modal-overlay.active {
    display: flex;
}

/* Modal Container */
.modal-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

/* Modal Body */
.modal-body {
    padding: 1.5rem;
    padding-bottom: 2rem; /* Ensure last row isn’t visually clipped */
    max-height: 70vh;
    overflow-y: auto;
}

/* Fee Table in Modal */
.modal-fee-table-container {
    overflow-x: auto;
    margin: 0 auto; /* Center the table block within modal */
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.modal-fee-table {
    width: 100%;            /* full width of container */
    max-width: 100%;        /* never overflow container width */
    min-width: 500px;
    border-collapse: collapse;
    margin: 0 auto;         /* center within container */
    table-layout: fixed;    /* fixed table layout for consistent column widths */
}

.modal-fee-table th,
.modal-fee-table td {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9rem;
    text-align: center;
}

/* Set specific column widths */
.modal-fee-table th:first-child,
.modal-fee-table td:first-child {
    width: 35%;
    text-align: left;
    padding-left: 2rem;
}

.modal-fee-table th:nth-child(2),
.modal-fee-table td:nth-child(2) {
    width: 35%;
}

.modal-fee-table th:last-child,
.modal-fee-table td:last-child {
    width: 30%;
}

/* Align numeric columns to the right for readability (body only) */
.modal-fee-table tbody td:nth-child(2),
.modal-fee-table tbody td:nth-child(3) {
    text-align: right;
    padding-right: 2rem;
}

.modal-fee-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.modal-fee-table tbody tr:hover {
    background: #f8f9fa;
}

.modal-fee-table tbody tr:last-child td {
    border-bottom: none;
}

/* Modal Button */
.modal-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #F39800;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    margin: 0.5rem 0;
}

.modal-trigger-btn:hover {
    background: #e88900;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(243, 152, 0, 0.3);
}

.modal-trigger-btn i {
    font-size: 1rem;
}

/* Mobile Optimizations */
@media (max-width: 767px) {
    .modal-container {
        max-width: 95vw;
        max-height: 85vh;
        margin: 0.5rem;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
    
    .modal-body {
        padding: 1rem;
        padding-bottom: 1.5rem; /* Extra space at bottom on small screens */
        max-height: 60vh;
    }
    
    .modal-fee-table {
        min-width: 400px;
    }
    
    .modal-fee-table th,
    .modal-fee-table td {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .modal-trigger-btn {
        width: 100%;
        justify-content: center;
        padding: 1rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 375px) {
    .modal-container {
        max-width: 98vw;
        margin: 0.25rem;
    }
    
    .modal-fee-table {
        min-width: 350px;
    }
    
    .modal-fee-table th,
    .modal-fee-table td {
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
    }
}
