/* Estilos generales de la plataforma (Sprint 1 — vistas MVC). */

:root {
    --primary: #2b6cb0;
    --primary-dark: #1a4e83;
    --success: #2f855a;
    --danger: #c53030;
    --text: #2d3748;
    --muted: #526477;
    --border: #e2e8f0;
    --bg: #f4f7fb;
    --card-bg: #ffffff;
}

.appointment-table-wrap { overflow-x: auto; }
.appointment-action { display: inline-block; margin: 0.25rem 0; }

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1rem;
}

a { color: var(--primary-dark); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid #286bb2; outline-offset: 4px; }
.skip-link { position: absolute; left: 1rem; top: -5rem; z-index: 20; padding: .8rem 1rem; background: #fff; border: 2px solid var(--primary); border-radius: 8px; }
.skip-link:focus { top: .5rem; }
.hero { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 2rem; padding: clamp(1.5rem, 4vw, 3rem); border: 1px solid #d8e5f0; border-radius: 20px; background: linear-gradient(125deg, #fff 15%, #edf6fc 100%); }
.hero h1 { font-size: clamp(1.75rem, 3vw, 2.6rem); line-height: 1.18; letter-spacing: -.035em; max-width: 24ch; }
.eyebrow { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--primary-dark); margin: 0 0 1rem; }
.hero-description { color: var(--muted); line-height: 1.7; max-width: 52ch; margin: 1.2rem 0 1.5rem; }
.hero-panel { background: #fff; padding: 1.75rem; border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 8px 24px #16324f08; align-self: center; min-width: 0; overflow-wrap: anywhere; }
.hero-panel h2 { margin: .8rem 0; font-size: 1.2rem; }
.hero-panel p { color: var(--muted); line-height: 1.65; }
.hero-panel a, .feature-card a { font-weight: 600; }
.hero-symbol { display: inline-flex; justify-content: center; align-items: center; background: #eaf3fb; width: 56px; height: 56px; border-radius: 16px; font-size: 1.7rem; }
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.section-heading { margin: 2.5rem 0 1.2rem; }
.section-heading h2 { margin: 0; font-size: 1.25rem; }
.feature-card { display: flex; flex-direction: column; align-items: flex-start; padding: 1.5rem; }
.feature-card p { color: var(--muted); line-height: 1.7; flex: 1; }
.feature-number { color: var(--primary); font-weight: 700; font-size: .8rem; margin-bottom: 1.2rem; }

/* ---------- Cabecera ---------- */

.site-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

.brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
    padding: .65rem .7rem;
    border-radius: 8px;
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-links a[aria-current="page"] { color: var(--primary-dark); background: #eaf3fb; font-weight: 600; }
.nav-links a.btn-primary { color: #fff; }

.nav-user {
    color: var(--muted);
    font-size: 0.9rem;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0 .5rem;
}

.inline-form {
    display: inline;
    margin: 0;
}

/* ---------- Contenido ---------- */

.main-content {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 3rem;
    min-width: 0;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

h1 {
    font-size: 1.6rem;
    margin: 0;
}

h2 {
    font-size: 1.2rem;
    margin: 2rem 0 1rem;
}

.lead {
    color: var(--muted);
    margin-top: 0.4rem;
}

/* ---------- Tarjetas ---------- */

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.card-title {
    margin: 0 0 0.4rem;
    font-size: 1.05rem;
}

.card-subtitle {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0 0 0.8rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 1rem;
}

/* ---------- Tablas ---------- */

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.table th,
.table td {
    text-align: left;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.93rem;
}

.table th {
    background: #edf2f7;
    font-weight: 600;
}

.table caption { text-align: left; padding: .8rem 0; font-weight: 600; }
.table tbody tr:hover { background: #f6faff; }
.table td:last-child { min-width: 180px; }
.table th, .table td { overflow-wrap: anywhere; max-width: 320px; }
.table th { white-space: nowrap; }
.status-booked { background: #ebf4ff; color: #234e8a; }
.status-cancelled { background: #fff0f0; color: #9b2c2c; }
.status-completed { background: #e8f7ee; color: #22543d; }
.status-noshow { background: #fff7df; color: #79540a; }
.summary-fields { display: grid; grid-template-columns: minmax(110px, .3fr) minmax(0, 1fr); gap: .9rem 1rem; margin: 1rem 0 1.5rem; }
.summary-fields dt { color: var(--muted); font-size: .9rem; }
.summary-fields dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.table tr:last-child td {
    border-bottom: none;
}

/* ---------- Formularios ---------- */

.form-card {
    max-width: 500px;
    margin: 0 auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.75rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
}

.password-field { position: relative; }
.password-field input { padding-right: 6.25rem; }
.password-toggle { position: absolute; right: .2rem; top: .1rem; bottom: .1rem; padding: .4rem .65rem; border: 0; border-radius: 6px; background: #edf3f9; color: var(--primary-dark); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; min-width: 5.5rem; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
    border-color: var(--primary);
}

.field-hint {
    color: var(--muted);
    font-size: 0.82rem;
    margin-top: 0.25rem;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.checkbox-group input {
    width: auto;
}

.checkbox-group label {
    font-weight: 400;
    font-size: 0.9rem;
    margin: 0;
}

/* ---------- Botones ---------- */

.btn {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    background: #edf2f7;
    color: var(--text);
    min-height: 44px;
    line-height: 1.4;
    text-align: center;
}

.btn:hover {
    filter: brightness(0.96);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    filter: none;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-danger { background: #fff1f1; border-color: #efc9c9; color: #9b2c2c; }

.btn-block {
    display: block;
    width: 100%;
}

.btn-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
}

.btn-link:hover {
    text-decoration: underline;
    filter: none;
}

/* ---------- Alertas ---------- */

.alert {
    padding: 0.8rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    font-size: 0.94rem;
    border: 1px solid transparent;
}

.alert-success {
    background: #f0fff4;
    border-color: #9ae6b4;
    color: #22543d;
}

.alert-danger {
    background: #fff5f5;
    border-color: #feb2b2;
    color: #742a2a;
}

.alert ul {
    margin: 0.3rem 0 0;
    padding-left: 1.1rem;
}

/* ---------- Validación ---------- */

.validation-summary {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #742a2a;
    border-radius: 6px;
    padding: 0.7rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Solo se muestra cuando hay errores (la tag helper alterna estas clases). */
.validation-summary-valid {
    display: none;
}

.validation-summary ul {
    margin: 0.3rem 0 0;
    padding-left: 1.1rem;
}

.field-validation-error {
    color: var(--danger);
    font-size: 0.83rem;
    display: block;
    margin-top: 0.25rem;
}

.input-validation-error {
    border-color: var(--danger) !important;
}

/* ---------- Detalle de mascota ---------- */

.detail-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 0.9rem;
    margin: 0;
}

.detail-list div {
    border-left: 3px solid var(--primary);
    padding-left: 0.7rem;
}

.detail-list dt {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.detail-list dd {
    margin: 0.2rem 0 0;
    font-weight: 600;
    overflow-wrap: anywhere; /* el código QR es largo y desbordaba la celda */
}

.consultation {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.9rem;
    background: var(--card-bg);
}

.consultation-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.consultation-header strong {
    font-size: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #ebf8ff;
    color: #2b6cb0;
}

.badge-success {
    background: #f0fff4;
    color: var(--success);
}

.subsection {
    margin-top: 0.8rem;
    padding-top: 0.7rem;
    border-top: 1px dashed var(--border);
}

.subsection h4 {
    margin: 0 0 0.4rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.subsection ul {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.9rem;
}

/* ---------- Historial de consultas ---------- */

.consultation-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.consultation-preview {
    margin: 0.4rem 0 0;
    overflow-wrap: anywhere;
}

/* ---------- Estado vacío ---------- */

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    background: var(--card-bg);
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--muted);
}

.empty-state p {
    margin: 0 0 1rem;
}

/* ---------- Footer ---------- */

.site-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
    padding: 1rem 0;
}

@media (max-width: 600px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .nav-links { width: 100%; gap: .2rem; }
    .nav-links a { padding: .65rem .6rem; }
    .nav-user { width: 100%; max-width: none; margin: .4rem 0; }
    .hero { grid-template-columns: 1fr; gap: 1.25rem; border-radius: 14px; }
    .hero-panel { padding: 1.25rem; }
    .action-row .btn { flex: 1 1 160px; }
    .form-card { padding: 1.25rem; }
    .page-header { align-items: flex-start; }
    .summary-fields { grid-template-columns: 1fr; gap: .2rem; }
    .summary-fields dd { margin-bottom: .8rem; }
}
