/**
 * V4 Design System - Modals
 * Modal system with backdrop, dialogs, and drawers
 */

/* ===== MODAL BACKDROP ===== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modal-fade-in 0.3s ease;
}

/* ===== MODAL CONTAINER ===== */

.modal {
    background: var(--surface-elevated);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-modal);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modal-slide-up 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Wide Modal */
.modal-wide {
    max-width: 720px;
}

/* Full Width Modal */
.modal-full {
    max-width: 95vw;
}

/* ===== MODAL SECTIONS ===== */

.modal-header {
    padding: 28px 28px 20px;
    border-bottom: 2px solid var(--border);
}

.modal-title {
    font-size: 24px;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.modal-subtitle {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.modal-body {
    padding: 28px;
}

.modal-footer {
    padding: 20px 28px 28px;
    display: flex;
    gap: 12px;
}

/* ===== MODAL BUTTONS ===== */

.modal-button {
    flex: 1;
    height: 52px;
    border-radius: var(--radius-md);
    border: none;
    font-size: 16px;
    font-weight: 800;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-button.cancel {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-secondary);
}

.modal-button.cancel:hover {
    background: var(--surface-2);
    border-color: var(--text-secondary);
}

.modal-button.primary {
    background: var(--color-add-green);
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
}

.modal-button.primary:hover {
    background: var(--color-add-green-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.modal-button.danger {
    background: var(--color-remove-red);
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
}

.modal-button.danger:hover {
    background: var(--color-remove-red-dark);
}

.modal-button:active {
    transform: scale(0.96);
}

/* ===== MODAL CONTENT COMPONENTS ===== */

/* Current Stock Display */
.current-stock-display {
    background: var(--surface-store);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.current-stock-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.current-stock-value {
    font-size: 28px;
    font-weight: 900;
    color: var(--text-primary);
}

/* Quantity Adjuster (for stock modals) */
.quantity-adjuster {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 24px;
}

.adjust-btn {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--color-price-blue);
    color: var(--text-inverse);
    font-size: 32px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

.adjust-btn:hover {
    background: var(--color-price-blue-dark);
    transform: scale(1.05);
}

.adjust-btn:active {
    transform: scale(0.95);
}

.adjust-quantity-display {
    font-size: 48px;
    font-weight: 900;
    color: var(--text-primary);
    min-width: 100px;
    text-align: center;
}

/* Section Titles in Modals */
.adjust-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* New Stock Preview */
.new-stock-preview {
    background: var(--color-add-green-light);
    padding: 16px;
    border-radius: var(--radius-md);
    text-align: center;
}

.new-stock-preview-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-add-green-dark);
    margin-bottom: 6px;
}

.new-stock-preview-value {
    font-size: 32px;
    font-weight: 900;
    color: var(--color-add-green-dark);
}

/* ===== DRAWER STYLE (Bottom Sheet) ===== */

.drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-elevated);
    border-radius: var(--radius-3xl) var(--radius-3xl) 0 0;
    box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.2);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: var(--z-drawer);
    max-height: 80vh;
    overflow-y: auto;
}

.drawer.open {
    transform: translateY(0);
}

.drawer-header {
    padding: 32px;
    text-align: center;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface-elevated);
    z-index: 1;
}

.drawer-title {
    font-size: 32px;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.drawer-body {
    padding: 32px;
}

.close-drawer {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--color-remove-red);
    color: var(--text-inverse);
    position: absolute;
    top: 20px;
    right: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

.close-drawer:active {
    transform: scale(0.9);
}

/* ===== CLOSE BUTTON (top right X) ===== */

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--surface-store);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}

.modal-close:active {
    transform: scale(0.9);
}

/* ===== MODAL ANIMATIONS ===== */
/* Portado de css/v4/animations.css (hoja huérfana, borrada en 4.4) — .modal-backdrop invoca esta animación en la línea 18. */
@keyframes modal-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
