/* Backdrop overlay */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeIn var(--transition-fast);
}

.modal-backdrop.active {
    display: flex;
}

/* Modal container */
.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    width: 100%;
    max-width: 520px;
    border: 1px solid var(--border-secondary);
    position: relative;
    animation: slideUp var(--transition-normal);
    max-height: 90vh;
    overflow-y: auto;
}

.modal.modal-sm {
    max-width: 400px;
    padding: 1.5rem;
}

/* Modal header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-secondary);
}

.modal-header h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Close button */
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Textarea (input styling comes from auth.css) */
.form-group textarea {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    width: 100%;
}

.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Button row */
.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-cancel {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex: 1;
}

.btn-cancel:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-danger {
    background: #cc3333;
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-md);
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex: 1;
}

.btn-danger:hover {
    background: #dd4444;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger:active {
    transform: translateY(0);
}

/* Error message */
.modal-error {
    background: rgba(204, 51, 51, 0.15);
    border: 1px solid rgba(204, 51, 51, 0.3);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: #ff6666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: none;
}

.modal-error.visible {
    display: block;
}

/* Delete modal */
.delete-warning {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.delete-post-title {
    color: var(--accent-primary);
    font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 480px) {
    .modal {
        margin: 1rem;
        padding: 1.5rem;
        max-width: calc(100vw - 2rem);
    }

    .modal-actions {
        flex-direction: column;
    }
}
