/* Shared Modal Styles (Global - Polished) */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none; /* JS toggles to flex */
    align-items: center;
    justify-content: center;
    z-index: 9999; 
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
    display: flex;
}

.modal-content {
    background-color: var(--color-surface);
    width: 90%;
    max-width: 480px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--color-border);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
}

.modal-overlay.visible .modal-content {
    transform: scale(1) translateY(0);
}

/* Premium Modal Specifics */
.premium-modal .modal-content {
    text-align: center;
}

.premium-modal .modal-body {
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.premium-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--color-primary);
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.2), rgba(var(--color-primary-rgb), 0.05));
    box-shadow: 0 10px 25px -5px rgba(var(--color-primary-rgb), 0.3);
}

.premium-icon svg {
    width: 40px;
    height: 40px;
}

.modal-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.premium-modal p {
    font-size: 1.05rem;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Benefits List inside Modal */
.premium-modal .upgrade-benefits {
    width: 100%;
    text-align: left;
    margin-bottom: 2rem;
    padding: 1.25rem;
    background-color: var(--color-background); /* Subtle bg */
    border-radius: 16px;
    border: 1px solid var(--color-border);
    box-sizing: border-box;
}

.premium-modal .upgrade-benefits li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text);
}

.premium-modal .upgrade-benefits li:last-child {
    margin-bottom: 0;
}

.modal-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Generic Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-surface);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

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

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
}

/* --- Shared Button Styles for Modals --- */
/* Re-use standard button classes where possible, or define specific modal overrides */
.modal-content .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.5rem;
    border-radius: 50px; /* Consistent Pill Shape */
    font-weight: 700;
    font-size: 1.05rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    box-sizing: border-box;
    width: 100%; /* Full width inside modals */
    position: relative;
    overflow: hidden;
}

.modal-content .btn:hover {
    transform: translateY(-2px);
}

.modal-content .btn:active {
    transform: translateY(0);
}

/* Primary Button Override for Modals to ensure consistency */
.modal-content .btn-primary {
    background-color: var(--color-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(var(--color-primary-rgb), 0.3);
}

.modal-content .btn-primary:hover {
    box-shadow: 0 8px 20px rgba(var(--color-primary-rgb), 0.4);
    filter: brightness(105%);
}

.modal-content .btn-secondary {
    background-color: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.modal-content .btn-secondary:hover {
    border-color: var(--color-text-muted);
    background-color: rgba(var(--color-surface-rgb), 0.5);
}

.modal-content .btn-danger {
    background-color: var(--color-error);
    color: white;
    box-shadow: 0 4px 12px rgba(var(--color-error-rgb), 0.3);
}

.modal-content .btn-danger:hover {
    background-color: #d32f2f;
    box-shadow: 0 8px 20px rgba(var(--color-error-rgb), 0.4);
}

/* Modal Footer */
.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background-color: var(--color-surface);
}

/* --- Responsive Adjustments --- */
@media (max-width: 480px) {
    .modal-content {
        width: 95%;
        border-radius: 20px;
    }
    .premium-modal .modal-body {
        padding: 2.5rem 1.5rem;
    }
    .modal-title {
        font-size: 1.5rem;
    }
}

/* --- Desktop Adjustment for Sidebar --- */
@media (min-width: 769px) {
    .modal-overlay {
        padding-left: 240px; /* Offset for Sidebar (updated to 240px) */
        justify-content: center; /* Centers within remaining space */
    }
}
