/**
 * CNPA Modal Styles
 *
 * Terms modal overlay, content, header, body, and footer.
 */

/* ========================================
   Modal Component (Terms)
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: var(--space-4);
}

.modal-content {
    background: var(--bg-surface, white);
    width: 100%;
    max-width: 800px;
    border-radius: var(--radius-lg, 8px);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    box-shadow: var(--shadow-xl, 0 4px 20px rgba(0, 0, 0, 0.15));
    position: relative;
}

.modal-header {
    padding: var(--space-4, 16px);
    border-bottom: 1px solid var(--gray-200, #eee);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-secondary, #666);
    padding: 0 var(--space-2);
}

.modal-body {
    padding: var(--space-4, 16px);
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

/* Markdown Content Styles */
.modal-body h1,
.modal-body h2,
.modal-body h3,
.modal-body h4 {
    margin-bottom: var(--space-3);
    color: var(--text-primary);
    font-weight: 600;
}

.modal-body h1 {
    font-size: 1.25rem;
}

.modal-body h2 {
    font-size: 1.125rem;
}

.modal-body h3 {
    font-size: 1rem;
}

.modal-body p {
    margin-bottom: var(--space-3);
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.9375rem;
}

.modal-body ul,
.modal-body ol {
    margin-bottom: var(--space-3);
    padding-left: var(--space-5);
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.modal-body li {
    margin-bottom: var(--space-1);
}

.modal-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

.modal-body hr {
    border: 0;
    border-top: 1px solid var(--gray-200);
    margin: var(--space-4) 0;
}

.term-item {
    margin-bottom: var(--space-4);
}

.modal-footer {
    padding: var(--space-4, 16px);
    border-top: 1px solid var(--gray-200, #eee);
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 12px);
    align-items: stretch;
    flex-shrink: 0;
    background: var(--bg-surface, white);
    border-bottom-left-radius: var(--radius-lg, 8px);
    border-bottom-right-radius: var(--radius-lg, 8px);
}

.modal-footer .btn {
    width: 100%;
    justify-content: center;
}

/* Utility for scroll hint */
.scroll-hint {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    display: block;
}

/* Desktop Overrides */
@media (min-width: 640px) {
    .modal-overlay {
        padding: var(--space-8);
    }

    .modal-content {
        width: 90%;
        max-height: 85vh;
    }

    .modal-header {
        padding: var(--space-4) var(--space-6);
    }

    .modal-header h3 {
        font-size: 1.25rem;
    }

    .modal-body {
        padding: var(--space-6);
    }

    .modal-body p,
    .modal-body ul,
    .modal-body ol {
        font-size: 1rem;
    }

    .modal-footer {
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        padding: var(--space-4) var(--space-6);
    }

    .modal-footer .btn {
        width: auto;
    }

    .scroll-hint {
        margin-bottom: 0;
        margin-right: var(--space-4);
    }
}
