/* Legal Modals (Privacy Policy & Terms of Service) */
.legal-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.modal-content {
    position: relative;
    background-color: var(--bg-color);
    margin: 5% auto;
    padding: 0;
    width: 80%;
    max-width: 800px;
    border-radius: var(--radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.4s;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background-color: var(--bg-color);
    border-radius: var(--radius) var(--radius) 0 0;
    z-index: 1;
}

.modal-header h2 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.5rem;
}

.close-modal {
    color: var(--text-color);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--primary-color);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    color: var(--text-color);
    line-height: 1.6;
}

.modal-body h3 {
    margin-top: 25px;
    margin-bottom: 15px;
    color: var(--text-color);
}

.modal-body p, .modal-body ul {
    margin-bottom: 15px;
}

.modal-body ul {
    padding-left: 20px;
}

.modal-body li {
    margin-bottom: 8px;
}

.last-updated {
    font-style: italic;
    margin-top: 30px;
    color: var(--text-light);
    text-align: right;
}

/* Dark theme specific adjustments */
[data-theme="dark"] .modal-content {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .modal-header {
    background-color: var(--bg-color);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .modal-body {
    background-color: var(--bg-color);
}

[data-theme="dark"] .close-modal {
    color: var(--text-color);
}

[data-theme="dark"] .close-modal:hover {
    color: var(--primary-color);
}

/* Animation */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar styling for better theme integration */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-lighter);
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
}
