/* =========================================
   VARIABLES Y CONFIGURACION DE MARCA
   ========================================= */
:root {
    --brand-teal: #00a4a6;
    --brand-teal-hover: #008f91;
    --verde-corporativo: #00a4a6;
    --verde-claro: #48c9b0;
    --arena: #f4f6f9;
    --gris-texto: #2c3e50;
    --gris-muted: #7f8c8d;
    --gris-suave: #e0e6ed;
    --rojo-error: #e74c3c;
    --azul-holded: #2781ff;
    --blanco: #FFFFFF;
    --shadow-premium: 0 4px 20px rgba(0, 0, 0, 0.05);
    --radius-lg: 20px;
    --radius-md: 12px;
}

/* =========================================
   RESETS Y GENERALES
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--arena);
    color: var(--gris-texto);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.contenedor {
    max-width: 1400px;
    width: 95%;
    margin: 0 auto;
    padding: 0 15px;
}

/* =========================================
   COMPONENTES PREMIUM
   ========================================= */

/* Tarjetas */
.card-premium {
    background: white;
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-premium);
    border: 1px solid var(--gris-suave);
    position: relative;
}

.card-premium-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--arena);
    padding-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.card-premium-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--brand-teal);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Botones */
.btn-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    width: auto;
    height: 42px;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-premium-teal {
    background: var(--brand-teal);
    color: white !important;
}

.btn-premium-teal:hover {
    background: var(--brand-teal-hover);
    transform: translateY(-2px);
}

.btn-premium-outline {
    background: white;
    border: 2px solid var(--brand-teal);
    color: var(--brand-teal) !important;
}

.btn-premium-outline:hover {
    background: var(--brand-teal);
    color: white !important;
}

.btn-premium-danger {
    background: #fff5f5;
    color: #e53e3e !important;
    border: 1px solid #feb2b2;
}

/* Badges */
.badge-premium {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-clinico {
    background: #e6fffa;
    color: #319795;
}

.badge-admin {
    background: #ebf8ff;
    color: #3182ce;
}

.badge-menor {
    background: #fff5f5;
    color: #e53e3e;
}

/* =========================================
   TIMELINE (HISTORIAL CLINICO)
   ========================================= */
/* =========================================
   HISTORIAL CLINICO (TARJETAS)
   ========================================= */
.timeline {
    position: relative;
    padding-left: 0;
    margin-top: 30px;
}

.timeline-item {
    position: relative;
    margin-bottom: 12px;
}

.timeline-content {
    background: white;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--gris-suave);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-item:hover .timeline-content {
    border-color: var(--brand-teal);
    transform: translateX(10px);
    box-shadow: var(--shadow-premium);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0;
    border-bottom: none;
}

.timeline-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 0;
}

.timeline-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.timeline-actions a {
    transition: transform 0.2s;
    font-size: 1.1rem;
}

.timeline-actions a:hover {
    transform: scale(1.2);
}

.timeline-date {
    font-weight: 800;
    color: var(--brand-teal);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-author {
    font-size: 0.8rem;
    color: var(--gris-muted);
    font-weight: 600;
    background: var(--arena);
    padding: 4px 10px;
    border-radius: 20px;
}

.timeline-body {
    color: var(--gris-texto);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* =========================================
   LAYOUT FICHA (2 COLUMNAS)
   ========================================= */
.layout-ficha {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    margin-top: 20px;
}

.main-ficha {
    flex: 1;
    min-width: 0;
    /* Evita que el flexbox rompa con contenido largo */
}

/* Sidebar Ficha */
.sidebar-ficha {
    flex: 0 0 320px;
    position: sticky;
    top: 90px;
    background: white;
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-premium);
    border: 1px solid var(--gris-suave);
    z-index: 10;
}

.avatar-placeholder {
    width: 80px;
    height: 80px;
    background: var(--arena);
    color: var(--brand-teal);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    margin: 0 auto 15px;
}

.sidebar-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--gris-texto);
    text-align: center;
    margin-bottom: 5px;
}

.sidebar-id {
    font-size: 0.85rem;
    color: var(--gris-muted);
    text-align: center;
    margin-bottom: 25px;
    font-weight: 600;
}

.sidebar-info-group {
    border-top: 1px solid var(--arena);
    padding-top: 20px;
}

.sidebar-item {
    margin-bottom: 20px;
}

.sidebar-item-label {
    display: block;
    font-size: 0.75rem;
    color: var(--gris-muted);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 5px;
}

.sidebar-item-value {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gris-texto);
}

/* =========================================
   ADAPTACION SAFARI E IPAD
   ========================================= */
.input-fecha-premium {
    display: inline-block !important;
    height: 35px;
    width: 155px !important;
    padding: 0 !important;
    border: 2px solid var(--brand-teal);
    border-radius: var(--radius-md);
    color: var(--brand-teal);
    font-weight: 800;
    font-size: 0.85rem !important;
    text-align: center !important;
    background: white;
    cursor: pointer;
    vertical-align: middle;
    line-height: 31px;
    /* Para centrado vertical */
    box-sizing: border-box;
    -webkit-appearance: none;
}

/* Eliminar estorbos de Safari/Chrome en inputs */
.input-fecha-premium::-webkit-inner-spin-button,
.input-fecha-premium::-webkit-calendar-picker-indicator,
.input-fecha-premium::-webkit-clear-button {
    display: none !important;
    -webkit-appearance: none !important;
}

.input-fecha-objetivo {
    width: 105px !important;
}

@media (max-width: 991px) {
    .layout-ficha {
        flex-direction: column;
    }

    .sidebar-ficha {
        flex: 1 1 100%;
        width: 100%;
        position: relative;
        top: 0;
    }

    .card-premium-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-premium-header>div {
        width: 100%;
        justify-content: flex-start !important;
    }
}

/* =========================================
   MODALES PREMIUM
   ========================================= */
.modal-premium {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-premium-content {
    background: white;
    padding: 0;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 850px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--gris-suave);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-premium-header {
    padding: 25px 35px;
    background: var(--arena);
    border-bottom: 1px solid var(--gris-suave);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-premium-header h2 {
    margin: 0;
    color: var(--brand-teal);
    font-size: 1.3rem;
    font-weight: 800;
    text-transform: uppercase;
}

.modal-premium-body {
    padding: 35px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.modal-premium-footer {
    padding: 25px 35px;
    border-top: 1px solid var(--gris-suave);
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    background: white;
}

/* Grids de Formulario en Modal */
.form-grid-premium {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.campo-premium {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.campo-premium label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--gris-muted);
}

.campo-premium input,
.campo-premium select {
    padding: 12px 15px;
    border-radius: var(--radius-md);
    border: 1px solid var(--gris-suave);
    font-size: 0.95rem;
    color: var(--gris-texto);
    background: #fdfdfd;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.campo-premium input:focus,
.campo-premium select:focus {
    outline: none;
    border-color: var(--brand-teal);
    box-shadow: 0 0 0 4px rgba(0, 164, 166, 0.1);
}

.seccion-tutor-premium {
    background: #fffcf0;
    border: 1px solid #ffe082;
    padding: 25px;
    border-radius: var(--radius-md);
    margin: 25px 0;
}

.seccion-responsables-premium {
    background: #f0f7ff;
    border: 1px solid #cfe2ff;
    padding: 25px;
    border-radius: var(--radius-md);
}

.grid-checks-premium {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.check-item-premium {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 12px 15px;
    border-radius: var(--radius-md);
    border: 1px solid #d1e3f8;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}