/* AGENDA PROFESIONAL - ESTILO MODERNO Y RESPONSIVO (VERSIÓN COMPACTA) */
:root {
    --primary: #2c7a5e;
    --primary-light: #e0f2e9;
    --primary-dark: #1e5a45;
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --text-dark: #1e2a32;
    --text-body: #334e68;
    --text-muted: #62748c;
    --border: #e2e8f0;
    --border-light: #edf2f7;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --radius-lg: 0.75rem;
    --radius-md: 0.5rem;
    --radius-sm: 0.375rem;
    --transition: all 0.2s ease;
}

/* Header */
.agenda-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Tarjetas de métricas más compactas */
.agenda-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.metric-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 0.8rem 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}
.metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
}
.metric-header span { color: var(--text-muted); font-size: 0.8rem; }
.metric-header strong { font-size: 1.5rem; color: var(--primary); font-weight: 700; }
.metric-card p { font-size: 0.75rem; margin: 0; }

/* Grid principal */
.agenda-board-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.2rem;
}
.agenda-calendar-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border-light);
}
.agenda-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 0.5rem;
}
.agenda-date-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.agenda-toolbar h2 { font-size: 1.2rem; font-weight: 600; margin-top: 0.1rem; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 2rem;
    padding: 0.3rem 0.8rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}
.btn-outline:hover { background: var(--bg-main); border-color: var(--primary); }
.agenda-calendar-content { padding: 1rem; }

/* VISTA SEMANA (7 días) */
.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.6rem;
}
.week-column {
    background: var(--bg-main);
    border-radius: var(--radius-md);
    padding: 0.6rem;
    border: 1px solid var(--border-light);
    transition: var(--transition);
}
.week-column:hover { border-color: var(--primary-light); }
.week-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}
.week-column-header span { font-weight: 700; }
.week-column-header small { font-size: 0.7rem; color: var(--text-muted); }

/* Tarjetas de eventos */
.event-card {
    background: white;
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--primary);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    font-size: 0.75rem;
}
.event-card:hover { transform: translateX(2px); background: #fefefe; }
.event-card strong { display: block; font-size: 0.8rem; font-weight: 600; }
.event-client { font-size: 0.7rem; color: var(--text-muted); }
.event-time { font-size: 0.65rem; font-weight: 500; color: var(--primary); }
.empty-slot {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 0.5rem 0;
}
.empty-slot:hover { background: var(--primary-light); border-radius: var(--radius-sm); }

/* VISTA DÍA */
.agenda-day-view {
    max-height: 65vh;
    overflow-y: auto;
    padding-right: 0.25rem;
}
.day-header { margin-bottom: 1rem; }
.day-date { font-size: 1.1rem; font-weight: 700; }
.day-sub { font-size: 0.75rem; color: var(--text-muted); }
.day-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border-left: 2px solid var(--border);
    margin-left: 3.5rem;
}
.timeline-hour {
    position: relative;
    min-height: 3.5rem;
    border-bottom: 1px dashed var(--border-light);
    display: flex;
    align-items: flex-start;
}
.hour-label {
    position: absolute;
    left: -3.5rem;
    top: 0;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding-right: 0.3rem;
}
.timeline-events { flex: 1; padding: 0.3rem 0 0.3rem 0.8rem; }

/* VISTA MES (compacta) */
.month-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.4rem;
}
.month-cell {
    background: var(--bg-main);
    border-radius: var(--radius-md);
    padding: 0.4rem;
    min-height: 70px;
    border: 1px solid transparent;
    transition: var(--transition);
    cursor: pointer;
}
.month-cell:not(.empty):hover { border-color: var(--primary-light); background: white; }
.month-cell.empty { background: transparent; border: none; cursor: default; }
.month-day-number { font-weight: 700; font-size: 0.8rem; margin-bottom: 0.2rem; }
.month-event {
    font-size: 0.65rem;
    background: var(--primary-light);
    padding: 0.15rem 0.3rem;
    border-radius: 0.2rem;
    margin-top: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--primary-dark);
    font-weight: 500;
    cursor: pointer;
}
.month-cell.past {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: default;
    opacity: 0.7;
}
.more-indicator {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.15rem 0.3rem;
    border-radius: 1rem;
    margin-top: 0.2rem;
    cursor: pointer;
    text-align: center;
    width: 100%;
}
.more-indicator:hover {
    background: var(--primary);
    color: white;
}

/* Panel lateral más compacto */
.agenda-info-card {
    align-self: start;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}
.info-header { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); }
.info-header h2 { font-size: 1.1rem; margin: 0; }
.info-sub { font-size: 0.7rem; color: var(--text-muted); margin: 0.2rem 0 0; }
.agenda-detail-card { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border-light); }
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.8rem;
    border-bottom: 1px dashed var(--border-light);
}
.detail-row strong { font-weight: 600; }
.event-list { padding: 0.8rem 1rem; }
.event-list h3 { font-size: 0.9rem; margin-bottom: 0.5rem; }
.event-list-item {
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--primary);
    font-size: 0.75rem;
}

/* Toolbar inferior compacta */
.agenda-bottom-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    flex-wrap: wrap;
    gap: 0.5rem;
}
.agenda-view-toggle-bottom {
    display: flex;
    background: var(--bg-main);
    border-radius: 2rem;
    padding: 0.15rem;
    gap: 0.15rem;
    border: 1px solid var(--border);
}
.agenda-view-toggle-bottom button {
    border: none;
    background: transparent;
    padding: 0.3rem 0.8rem;
    border-radius: 2rem;
    font-weight: 500;
    font-size: 0.75rem;
    cursor: pointer;
    color: var(--text-muted);
}
.agenda-view-toggle-bottom button.active {
    background: var(--primary);
    color: white;
}

/* Formulario */
.form-input {
    width: 100%;
    padding: 0.4rem;
    margin: 0.4rem 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 2rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.75rem;
    margin-right: 0.5rem;
}

/* Íconos de agregar */
.add-session-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}
.add-session-icon:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}
.add-session-icon.disabled, .add-session-icon.disabled:hover {
    background: #cbd5e1;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.6;
}
.week-add-icon {
    background: none;
    border: 1px solid var(--primary);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary);
    font-weight: bold;
    font-size: 0.8rem;
}
.week-add-icon:hover {
    background: var(--primary);
    color: white;
}
.timeline-hour .add-session-icon {
    position: absolute;
    right: 0.3rem;
    top: 0.2rem;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
}
.month-add-icon {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
}
.day-details { padding: 0.5rem 0; }
.day-event-item {
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    border-left: 3px solid var(--primary);
    font-size: 0.75rem;
}
.back-to-day-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.7rem;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

/* Responsivo */
@media (max-width: 1100px) {
    .agenda-board-grid { grid-template-columns: 1fr; }
    .week-grid { overflow-x: auto; grid-template-columns: repeat(7, minmax(200px, 1fr)); }
}
@media (max-width: 780px) {
    .agenda-summary-grid { grid-template-columns: 1fr; }
    .agenda-day-view { max-height: 50vh; }
    .agenda-info-card { position: static; max-height: none; }
}
@media (max-width: 480px) {
    .agenda-calendar-content { padding: 0.5rem; }
    .week-column-header { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
    .month-cell { min-height: 55px; }
}
/* =========================================
   Mejoras de gestión: formulario, solicitudes y limpieza de estilos inline
   ========================================= */
.detail-fields,
.add-session-form {
    display: none;
}

.add-session-form {
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.agenda-form-label {
    display: block;
    margin-top: 0.55rem;
    color: var(--text-dark);
    font-size: 0.75rem;
    font-weight: 700;
}

.agenda-form-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.week-count-actions,
.month-cell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.3rem;
}

.detail-empty-inline {
    display: block;
}

.empty-slot-small {
    font-size: 0.65rem;
}

.agenda-requests-panel {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-light);
}

.event-list-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.event-list-title-row h3 {
    font-size: 0.9rem;
    margin: 0;
}

.event-list-title-row span {
    display: inline-grid;
    place-items: center;
    min-width: 1.55rem;
    height: 1.55rem;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.8rem;
    font-weight: 800;
}

.agenda-request-list {
    display: grid;
    gap: 0.55rem;
}

.agenda-request-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.65rem;
    align-items: center;
    padding: 0.65rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-main);
}

.agenda-request-item strong,
.agenda-request-item span {
    display: block;
}

.agenda-request-item strong {
    color: var(--text-dark);
    font-size: 0.82rem;
}

.agenda-request-item span {
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-top: 0.15rem;
}

@media (max-width: 480px) {
    .agenda-request-item {
        grid-template-columns: 1fr;
    }
}
.empty-slot-message {
    color: var(--text-muted);
    padding: 0.3rem;
}

/* =========================================
   Bandeja profesional de solicitudes del psicólogo
   ========================================= */
.agenda-requests-preview {
    display: grid;
    gap: 0.65rem;
}

.agenda-preview-copy {
    margin: -0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.agenda-request-item a.btn-outline {
    text-decoration: none;
}

.psych-request-inbox {
    display: grid;
    gap: 1rem;
    margin-top: 1.2rem;
    padding: 1.2rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    scroll-margin-top: 1rem;
}

.request-inbox-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.2rem;
    align-items: center;
}

.request-inbox-header h2 {
    margin: 0.25rem 0 0.35rem;
    color: var(--text-dark);
    font-size: clamp(1.45rem, 2vw, 1.9rem);
}

.request-inbox-header p {
    margin: 0;
    max-width: 760px;
    color: var(--text-muted);
    line-height: 1.65;
}

.request-inbox-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(90px, 1fr));
    gap: 0.7rem;
}

.request-inbox-stats article {
    min-width: 94px;
    padding: 0.85rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--bg-main);
    text-align: center;
}

.request-inbox-stats strong,
.request-inbox-stats span {
    display: block;
}

.request-inbox-stats strong {
    color: var(--text-dark);
    font-size: 1.55rem;
    line-height: 1;
}

.request-inbox-stats span {
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.psych-request-tabs {
    display: flex;
    gap: 0.7rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    border-bottom: 1px solid var(--border-light);
    scrollbar-width: thin;
}

.psych-request-tab {
    flex: 0 0 auto;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--text-muted);
    padding: 0.75rem 0.9rem;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.psych-request-tab:hover,
.psych-request-tab.active {
    color: var(--primary-dark);
    border-bottom-color: var(--primary);
}

.psych-request-list {
    display: grid;
    gap: 0.9rem;
}

.psych-request-card {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(28, 46, 40, 0.06);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.psych-request-card:hover {
    transform: translateY(-1px);
    border-color: rgba(61, 155, 122, 0.25);
    box-shadow: 0 14px 34px rgba(28, 46, 40, 0.09);
}

.psych-request-card.is-resolved {
    opacity: 0.78;
}

.request-date-box {
    display: grid;
    place-items: center;
    align-content: center;
    min-height: 100px;
    border-radius: 18px;
    background: var(--bg-main);
    text-align: center;
}

.request-date-box span {
    color: var(--primary-dark);
    font-weight: 900;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
}

.request-date-box strong {
    color: var(--text-dark);
    font-family: var(--font-heading);
    font-size: 2.1rem;
    line-height: 1;
    margin: 0.15rem 0;
}

.request-date-box small {
    color: #8190a5;
    font-size: 0.82rem;
}

.request-card-body {
    min-width: 0;
}

.request-card-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.request-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.32rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 900;
}

.request-status.status-new {
    color: var(--primary-dark);
    background: rgba(61, 155, 122, 0.14);
}

.request-status.status-reschedule {
    color: #9a6a00;
    background: #fff7df;
}

.request-status.status-resolved {
    color: #4f5f5a;
    background: var(--bg-main);
}

.request-hour {
    color: var(--text-dark);
    font-weight: 900;
}

.request-code {
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.84rem;
}

.request-card-body h3 {
    margin: 0 0 0.35rem;
    color: var(--text-dark);
    font-size: 1.25rem;
}

.request-card-body p {
    margin: 0;
    max-width: 860px;
    color: var(--text-body);
    line-height: 1.55;
}

.request-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.65rem;
}

.request-card-meta span {
    display: inline-flex;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.request-card-actions {
    display: flex;
    justify-content: flex-end;
    min-width: 130px;
}

.request-empty-state {
    display: grid;
    place-items: center;
    gap: 0.35rem;
    padding: 2rem 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-main);
    text-align: center;
}

.request-empty-state i {
    color: var(--primary);
    font-size: 1.6rem;
}

.request-empty-state h3,
.request-empty-state p {
    margin: 0;
}

.request-empty-state p {
    color: var(--text-muted);
}

.request-response-field {
    display: grid;
    gap: 0.45rem;
    margin-top: 1rem;
    color: var(--text-dark);
    font-weight: 800;
}

.request-response-field textarea {
    width: 100%;
    min-height: 90px;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.8rem 0.9rem;
    background: #ffffff;
    color: var(--text-body);
    font: inherit;
}

.request-response-field textarea:focus {
    outline: 2px solid rgba(61, 155, 122, 0.18);
    border-color: var(--primary);
}

@media (max-width: 980px) {
    .request-inbox-header {
        grid-template-columns: 1fr;
    }

    .request-inbox-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .psych-request-card {
        grid-template-columns: 82px minmax(0, 1fr);
        align-items: start;
    }

    .request-card-actions {
        grid-column: 2;
        justify-content: flex-start;
    }

    .request-date-box {
        min-height: 88px;
    }
}

@media (max-width: 620px) {
    .psych-request-inbox {
        padding: 1rem;
        border-radius: var(--radius-lg);
    }

    .request-inbox-stats {
        grid-template-columns: 1fr;
    }

    .psych-request-tabs {
        gap: 0.35rem;
    }

    .psych-request-tab {
        padding: 0.65rem 0.7rem;
        font-size: 0.9rem;
    }

    .psych-request-card {
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 0.75rem;
        padding: 0.85rem;
    }

    .request-date-box {
        min-height: 80px;
        border-radius: 14px;
    }

    .request-date-box strong {
        font-size: 1.55rem;
    }

    .request-card-body h3 {
        font-size: 1.05rem;
    }

    .request-card-body p,
    .request-card-meta span {
        font-size: 0.82rem;
    }

    .request-card-actions,
    .request-card-actions .btn-primary-small {
        width: 100%;
    }
}


/* Corrección funcional: los filtros de solicitudes usan hidden y clase is-hidden.
   Estas reglas evitan que display:grid de las tarjetas anule el ocultamiento. */
.psych-request-card[hidden],
.psych-request-card.is-hidden,
.request-empty-state[hidden],
.request-empty-state.is-hidden {
    display: none !important;
}

.psych-request-tab:focus {
    outline: none;
}

.psych-request-tab:focus-visible {
    outline: 2px solid rgba(44, 122, 94, 0.35);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}
