/*
 * CARTILLA DIGITAL — Hoja de Estilos Clínica estilo PUPPY.pdf
 * Unifica la arquitectura visual Web con el motor ReportLab:
 * 1. Cabecera institucional con recuadro azul para CÓDIGO DE FICHA
 * 2. Franja superior de 3 bloques (Foto cuadrada | Ficha de 9 datos | QR o Acciones)
 * 3. Tablas clínicas y preventivas de ancho completo con insignias de vigencia
 * 4. Blindaje estricto de privacidad para la vista del tutor (Zero PII)
 */

/* ==========================================================================
   1. CABECERA INSTITUCIONAL Y BANNER
   ========================================================================== */

#section-cartilla .clinic-card-header {
    background: #ffffff;
    border: 1px solid #d8e6ef;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(11, 116, 200, 0.04);
}

#section-cartilla .clinic-info-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

#section-cartilla .clinic-logo-view {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 2px;
}

#section-cartilla .clinic-text-brand h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #16364a;
    margin: 0 0 4px 0;
}

#section-cartilla .clinic-text-brand p {
    font-size: 0.85rem;
    color: #607789;
    margin: 0;
    line-height: 1.35;
}

#section-cartilla .cartilla-code-badge {
    background: #eaf5ff;
    border: 1.5px solid #0b74c8;
    border-radius: 8px;
    padding: 8px 16px;
    text-align: center;
    min-width: 150px;
}

#section-cartilla .cartilla-code-lbl {
    font-size: 0.65rem;
    font-weight: 700;
    color: #607789;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#section-cartilla .cartilla-code-num {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0b74c8;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   2. FRANJA SUPERIOR HORIZONTAL DE 3 BLOQUES (PUPPY.pdf)
   ========================================================================== */

#section-cartilla .cartilla-main-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

#section-cartilla .cartilla-side-col {
    display: grid;
    grid-template-columns: 210px 1fr 240px;
    gap: 16px;
    background: #ffffff;
    border: 1px solid #d8e6ef;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(11, 116, 200, 0.04);
}

@media (max-width: 960px) {
    #section-cartilla .cartilla-side-col {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Bloque 1: Foto del paciente */
#section-cartilla .cartilla-profile-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid #edf4f9;
    padding-right: 16px;
}

@media (max-width: 960px) {
    #section-cartilla .cartilla-profile-card {
        border-right: none;
        border-bottom: 1px solid #edf4f9;
        padding-right: 0;
        padding-bottom: 16px;
    }
}

#section-cartilla .cartilla-photo {
    width: 170px;
    height: 170px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #d8e6ef;
    background: #f6fafd;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

#section-cartilla .cartilla-pet-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #16364a;
    margin: 10px 0 0 0;
    text-align: center;
}

/* Bloque 2: Grilla estructurada de 9 datos (matching _info_grid ReportLab) */
#section-cartilla .cartilla-details-list {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px 16px !important;
    width: 100%;
    margin-top: 6px;
}

@media (max-width: 600px) {
    #section-cartilla .cartilla-details-list {
        grid-template-columns: 1fr !important;
    }
}

#section-cartilla .cartilla-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid #edf4f9;
    padding-bottom: 4px;
}

#section-cartilla .cartilla-detail-lbl {
    font-size: 0.72rem;
    font-weight: 700;
    color: #607789;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

#section-cartilla .cartilla-detail-val {
    font-size: 0.85rem;
    font-weight: 600;
    color: #16364a;
    text-align: right;
}

/* Bloque 3: QR o Panel de Acciones */
#section-cartilla .qr-card {
    background: #f6fafd;
    border: 1px solid #d8e6ef;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#section-cartilla .qr-box {
    background: #ffffff;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #d8e6ef;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#section-cartilla .qr-box img,
#section-cartilla .qr-box canvas {
    max-width: 120px;
    max-height: 120px;
}

/* Ficha de datos del tutor (oculta en vista tutor por tutor-privacy.css) */
#section-cartilla .tutor-card {
    grid-column: 1 / -1;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px 16px;
    align-items: center;
}

#section-cartilla .tutor-card-title {
    grid-column: 1 / -1;
    font-size: 0.85rem;
    font-weight: 700;
    color: #16364a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 4px 0;
}

#section-cartilla .tutor-item {
    display: flex;
    gap: 6px;
    font-size: 0.8rem;
}

#section-cartilla .tutor-lbl {
    font-weight: 700;
    color: #64748b;
}

#section-cartilla .tutor-val {
    font-weight: 600;
    color: #1e293b;
}

/* ==========================================================================
   3. TABLAS CLÍNICAS Y PREVENTIVAS DE ANCHO COMPLETO
   ========================================================================== */

#section-cartilla .cartilla-content-col {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#section-cartilla .clinical-section {
    background: #ffffff;
    border: 1px solid #d8e6ef;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(11, 116, 200, 0.04);
}

#section-cartilla .clinical-section .section-header {
    background: #f6fafd;
    border-bottom: 1px solid #d8e6ef;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#section-cartilla .clinical-section .section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #16364a;
    margin: 0;
}

#section-cartilla .table-container {
    width: 100%;
    overflow-x: auto;
}

#section-cartilla table.clinic-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

#section-cartilla table.clinic-table th {
    background: #eaf5ff;
    color: #16364a;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 9px 12px;
    border: 1px solid #d8e6ef;
    text-align: left;
}

#section-cartilla table.clinic-table td {
    padding: 9px 12px;
    border: 1px solid #d8e6ef;
    color: #334155;
    vertical-align: top;
}

#section-cartilla table.clinic-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

#section-cartilla table.clinic-table tbody tr:hover {
    background: #f1f5f9;
}

/* ==========================================================================
   4. INSIGNIAS DE VIGENCIA (AL DÍA, PRÓXIMA, VENCIDA)
   ========================================================================== */

.badge-vigencia {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-vigencia-al-dia {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-vigencia-proxima {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-vigencia-vencida {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* ==========================================================================
   5. PANEL DE ACCIÓN RÁPIDA EN VISTA TUTOR MÓVIL
   ========================================================================== */

.tutor-quick-actions {
    display: none;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

body.tutor-view .tutor-quick-actions,
body.public-view .tutor-quick-actions {
    display: flex;
}

.tutor-quick-actions .btn-tutor-cita {
    background: #0b74c8;
    color: #ffffff;
    font-weight: 700;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-align: center;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(11, 116, 200, 0.25);
    transition: background 0.15s ease, transform 0.1s ease;
}

.tutor-quick-actions .btn-tutor-cita:hover {
    background: #09599a;
    transform: translateY(-1px);
}

.tutor-quick-actions .btn-tutor-pdf {
    background: #ffffff;
    color: #16364a;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1.5px solid #d8e6ef;
    cursor: pointer;
    text-align: center;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.tutor-quick-actions .btn-tutor-pdf:hover {
    background: #f8fafc;
    border-color: #0b74c8;
}

.tutor-reminder-pill {
    background: #eaf5ff;
    border: 1px solid #bce0fd;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.78rem;
    color: #16364a;
    display: flex;
    align-items: center;
    gap: 6px;
}
