/* =============================================
   MODAL SELECCIONAR VIDRIO DE STOCK (calendar.php)
   ============================================= */
#stock-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.45);
    align-items: center;
    justify-content: center;
}
#stock-modal .table {
    margin-bottom: 10px;
}
#stock-modal input[type="number"] {
    width: 60px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 1em;
}
#stock-paginacion {
    display: flex;
    gap: 4px;
    margin-top: 10px;
    justify-content: center;
}
#stock-paginacion .button {
    padding: 4px 10px;
    font-size: .98em;
}
:root{--accent:#0a6}
*{box-sizing:border-box}body{font-family:system-ui,Segoe UI,Roboto,Arial;margin:0;background:#f6f7f9;color:#111}
.container{max-width:1024px;margin:32px auto;padding:0 16px}
.card{background:#fff;border:1px solid #e5e7eb;border-radius:10px;padding:16px;margin-bottom:16px;box-shadow:0 1px 2px rgba(0,0,0,.05)}
.input{width:100%;padding:10px;border:1px solid #d1d5db;border-radius:8px}
.button{background:var(--accent);color:#fff;border:none;padding:10px 14px;border-radius:8px;cursor:pointer}
nav{background:#fff;border-bottom:1px solid #e5e7eb}
nav .wrap{display:flex;gap:12px;align-items:center;padding:10px 16px}
nav a{color:#111;text-decoration:none;border:1px solid #e5e7eb;border-radius:8px;padding:6px 10px}
nav .right{margin-left:auto}
.table{width:100%;border-collapse:collapse}
.table th,.table td{padding:8px;border-bottom:1px solid #eee;text-align:left}
.alert{padding:10px;border-radius:8px;margin:8px 0}
.alert.err{background:#ffe6e6;color:#7a0000}
.alert.ok{background:#e6ffef;color:#004d1a}

/* Paginación */
.pagination { display:flex; gap:6px; align-items:center; margin-top:12px; flex-wrap:wrap }
.pagination .page-link, .pagination .page-ellipsis{
  display:inline-block; padding:6px 10px; border:1px solid #e5e7eb; border-radius:8px; text-decoration:none; color:#111; background:#fff;
}
.pagination .page-link.active { background:var(--accent); color:#fff; border-color:var(--accent) }
.pagination .page-link.disabled { pointer-events:none; opacity:.5 }
.pagination .page-ellipsis { border:0 }

/* Tabla */
.table thead th { position:sticky; top:0; background:#fafafa; z-index:1 }
.table tbody tr:hover { background:#f7fafc }
.sortable { cursor:pointer; user-select:none; }
.sortable:hover { text-decoration:underline; }

/* =============================================
   MODAL POPUP
   ============================================= */

/* Backdrop — cubre TODO el viewport sin importar el DOM padre */
.modal-backdrop {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;   /* inset:0 equivalente */
    background: rgba(0, 0, 0, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}

/* Ventana */
.modal-window {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .35);
    display: flex;
    flex-direction: column;
    position: relative;   /* para que z-index sea mayor que el backdrop */
    z-index: 10000;
}

/* Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #e5e7eb;
}
.modal-header h3 { margin: 0; font-size: 1.1rem; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
    padding: 2px 8px;
    border-radius: 6px;
    transition: background .15s, color .15s;
}
.modal-close:hover { background: #f3f4f6; color: #111; }

/* Body */
.modal-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Footer */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px 18px;
    border-top: 1px solid #e5e7eb;
}

/* Botón secundario */
.btn-secondary { background: #f3f4f6; color: #374151; }
.btn-secondary:hover { background: #e5e7eb; }

/* Grupos de formulario */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
    font-size: .82rem;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* Selector de color */
.color-picker { display: flex; gap: 10px; align-items: center; }
.color-option input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.color-swatch {
    display: block;
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform .15s, border-color .15s;
}
.color-option input[type="radio"]:checked + .color-swatch { border-color: #111; transform: scale(1.2); }
.color-swatch:hover { transform: scale(1.1); }

/* ── Animaciones Alpine (nombres únicos para evitar conflictos) ── */
/* Backdrop: fade */
.modal-fade-enter      { transition: opacity .2s ease; }
.modal-fade-from       { opacity: 0; }
.modal-fade-to         { opacity: 1; }
.modal-fade-leave      { transition: opacity .15s ease; }

/* Ventana: fade + scale */
.modal-pop-enter       { transition: opacity .2s ease, transform .2s ease; }
.modal-pop-from        { opacity: 0; transform: scale(.95) translateY(-8px); }
.modal-pop-to          { opacity: 1; transform: scale(1)   translateY(0); }
.modal-pop-leave       { transition: opacity .15s ease, transform .15s ease; }