/* ── Cards ── */
.card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem;
}

.card-surface {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

/* ── Botones ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover { opacity: 0.92; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-primary-dark);
    border: 1.5px solid var(--color-border);
}

.btn-secondary:hover { border-color: var(--color-primary); }

.btn-danger {
    background: var(--status-cancelado-bg);
    color: var(--status-cancelado);
    border: 1.5px solid var(--status-cancelado);
}

.btn-danger:hover { background: var(--status-cancelado); color: white; }

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-primary-dark);
    border: 1.5px solid var(--color-border);
}

.btn-icon:hover { border-color: var(--color-primary); }

.btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* ── Formularios ── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1rem; }

.form-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    font-weight: 700;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    background: var(--color-white);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    color: var(--color-text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
}

.form-select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23A8892A' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* ── Tablas ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--color-border); }

table.data-table { width: 100%; border-collapse: collapse; background: var(--color-white); }

table.data-table th {
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    background: var(--color-surface);
    padding: 0.9rem 1rem;
    font-weight: 700;
    white-space: nowrap;
}

table.data-table td {
    padding: 0.9rem 1rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.875rem;
}

table.data-table tr:hover td { background: rgba(250, 243, 228, 0.5); }

/* ── Badges (estado) ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-reservado  { background: var(--status-reservado-bg);  color: var(--status-reservado); }
.badge-confirmado { background: var(--status-confirmado-bg); color: var(--status-confirmado); }
.badge-cancelado  { background: var(--status-cancelado-bg);  color: var(--status-cancelado); }
.badge-completado { background: var(--status-completado-bg); color: var(--status-completado); }
.badge-noasistio  { background: var(--status-noasistio-bg);  color: var(--status-noasistio); }
.badge-pendiente  { background: var(--status-pendiente-bg);  color: var(--status-pendiente); }
.badge-activo   { background: var(--status-confirmado-bg); color: var(--status-confirmado); }
.badge-inactivo { background: var(--color-surface); color: var(--color-text-muted); }

/* ── Modal ── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(42, 33, 24, 0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.15s ease-out;
}

.modal-box {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.2s ease-out;
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.5rem 1.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

.modal-body { padding: 1.5rem 1.75rem; }
.modal-footer {
    display: flex; gap: 0.75rem; justify-content: flex-end;
    padding: 1rem 1.75rem 1.5rem;
}

.modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--color-text-muted); font-size: 1.4rem; line-height: 1;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* ── Estados vacíos / carga ── */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 3rem 1.5rem; text-align: center; color: var(--color-text-muted);
    gap: 0.5rem;
}

.spinner {
    width: 22px; height: 22px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
.toast {
    position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
    z-index: 2000;
    display: flex; align-items: center; gap: 10px;
    padding: 0.9rem 1.3rem;
    border-radius: var(--radius-md);
    font-weight: 700; font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    animation: slideUpToast 0.25s ease-out;
}

.toast-success { background: var(--status-confirmado); color: white; }
.toast-error { background: var(--status-cancelado); color: white; }

@keyframes slideUpToast {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Editor de horarios (tarjetas por día) ── */
.horarios-toolbar { margin-bottom: 1rem; }

.horarios-list { display: flex; flex-direction: column; gap: 10px; }

.horario-card {
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 0.9rem 1.1rem;
    background: var(--color-white);
    transition: border-color 0.15s, background 0.15s;
}

.horario-card.activo { border-color: var(--color-primary-light); background: var(--status-reservado-bg); }

.horario-card-header { display: flex; align-items: center; justify-content: space-between; }

.horario-dia-nombre { font-weight: 700; font-size: 0.95rem; color: var(--color-text); }

.switch { position: relative; display: inline-block; width: 46px; height: 26px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
    position: absolute; inset: 0; background: var(--color-border); border-radius: 999px; transition: background 0.2s;
}
.switch-thumb {
    position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
    background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: transform 0.2s;
}
.switch input:checked + .switch-track { background: var(--color-primary); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); }

.horario-inputs { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid var(--color-border); }

.horario-franja { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.horario-franja:last-of-type { margin-bottom: 0; }

.horario-franja-label { font-size: 0.82rem; font-weight: 600; min-width: 84px; flex-shrink: 0; }

.horario-franja-inputs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.horario-franja-inputs input[type="time"] { width: 110px; padding: 0.45rem 0.6rem; }

/* ── Agenda semanal (estilo calendario) ── */
.semana-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width: 900px) {
    .semana-grid { grid-template-columns: 1fr; }
}

.semana-col {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    min-height: 140px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.semana-col-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.semana-col-header.hoy { background: var(--status-reservado-bg); }

.semana-col-dia {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    font-weight: 700;
}

.semana-col-numero {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    flex: 1;
}

.semana-col-add {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: white;
    color: var(--color-primary-dark);
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.semana-col-add:hover { border-color: var(--color-primary); }

.semana-col-body {
    flex: 1;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.semana-chip {
    padding: 0.4rem 0.55rem;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    cursor: pointer;
    line-height: 1.3;
}

.semana-chip-sub { color: inherit; opacity: 0.75; font-size: 0.68rem; }

.chip-reservado  { background: var(--status-reservado-bg);  color: var(--status-reservado); }
.chip-confirmado { background: var(--status-confirmado-bg); color: var(--status-confirmado); }
.chip-cancelado  { background: var(--status-cancelado-bg);  color: var(--status-cancelado); text-decoration: line-through; opacity: 0.7; }
.chip-completado { background: var(--status-completado-bg); color: var(--status-completado); }
.chip-noasistio  { background: var(--status-noasistio-bg);  color: var(--status-noasistio); }
.chip-pendiente  { background: var(--status-pendiente-bg);  color: var(--status-pendiente); }

/* ── Utilidades ── */
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
