/* ==========================================================================
   ScribeClin - Agenda
   Grade dia/semana, blocos por status e navegação entre telas.
   ========================================================================== */

/* --- Navegação entre telas (header) -------------------------------------- */
.view-nav {
    display: flex;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
}

.view-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

.view-tab i { width: 15px; height: 15px; }

.view-tab.active {
    background: var(--accent);
    color: var(--on-accent);
}

.view-nav-divider {
    width: 1px;
    height: 18px;
    background: var(--border);
    align-self: center;
    margin: 0 4px;
}

/* Em modo agenda, os controles de consulta do header saem de cena. */
.agenda-mode .specialty-container,
.agenda-mode .header-status { display: none; }

/* --- Toolbar -------------------------------------------------------------- */
.agenda-view { display: flex; flex-direction: column; gap: 12px; }

.ag-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ag-nav { display: flex; align-items: center; gap: 6px; }

.ag-date-label {
    margin-left: 10px;
    font-weight: 600;
    text-transform: capitalize;
    color: var(--text-primary);
}

.ag-controls { display: flex; align-items: center; gap: 10px; }

.ag-view-toggle {
    display: flex;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.ag-week-prof { max-width: 220px; }

/* --- Grade ---------------------------------------------------------------- */
.ag-grid {
    display: flex;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    max-height: calc(100vh - 220px);
}

.ag-gutter { flex: 0 0 56px; border-right: 1px solid var(--border); }

.ag-hour {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: right;
    padding-right: 6px;
    border-top: 1px dashed rgba(128, 140, 160, 0.15);
    box-sizing: border-box;
}

.ag-col {
    flex: 1 1 0;
    min-width: 140px;
    border-right: 1px solid var(--border);
}
.ag-col:last-child { border-right: none; }

.ag-col-head {
    position: sticky;
    top: 0;
    z-index: 2;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    text-transform: capitalize;
}

.ag-col-body {
    position: relative;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0, transparent 25px,
        rgba(128, 140, 160, 0.12) 25px, rgba(128, 140, 160, 0.12) 26px
    );
    cursor: copy;
}

.ag-empty {
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* --- Bloco de agendamento -------------------------------------------------- */
.ag-appt {
    position: absolute;
    left: 3px;
    right: 3px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    padding: 3px 6px;
    border: none;
    border-left: 3px solid;
    border-radius: 6px;
    font: inherit;
    font-size: 0.72rem;
    text-align: left;
    cursor: pointer;
    z-index: 1;
}

.ag-appt-time { font-weight: 700; font-size: 0.66rem; opacity: 0.85; }
.ag-appt-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Cores por status — mesmas nas grades e no badge do detalhe. */
.ag-st-agendado   { background: rgba(99, 102, 241, 0.18);  border-color: var(--accent); color: var(--accent-text); }
.ag-st-confirmado { background: rgba(34, 197, 94, 0.18);   border-color: var(--success); color: var(--success-text); }
.ag-st-atendido   { background: rgba(148, 163, 184, 0.18); border-color: var(--neutral); color: var(--neutral-text); }
.ag-st-faltou     { background: rgba(239, 68, 68, 0.18);   border-color: var(--danger); color: var(--danger-text); }
.ag-st-cancelado  {
    background: rgba(120, 120, 130, 0.10);
    border-color: var(--text-muted);
    color: var(--text-muted);
    text-decoration: line-through;
    opacity: 0.7;
}

/* --- Detalhe ---------------------------------------------------------------- */
.ag-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    border-left-width: 3px;
    border-left-style: solid;
    font-size: 0.78rem;
    font-weight: 600;
}

.ag-det-sub { margin: 2px 0 0; font-size: 0.78rem; color: var(--text-muted); }
.ag-det-status-row { margin-bottom: 12px; }

.ag-det-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.ag-det-trail {
    margin: 6px 0 0;
    padding-left: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
    max-height: 140px;
    overflow-y: auto;
}
.ag-det-trail li { margin-bottom: 4px; }
.ag-det-trail em { opacity: 0.85; }

/* --- Formulário do modal ----------------------------------------------------- */
.ag-row { display: flex; gap: 10px; }
.ag-row > span { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.modal-sm { max-width: 440px; }
.modal-footer { display: flex; justify-content: flex-end; margin-top: 6px; }

.ag-btn-whatsapp {
    background: var(--success) !important;
    color: var(--on-accent) !important;
    border: none !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}
.ag-btn-whatsapp:hover {
    filter: brightness(0.92);
}
.ag-btn-whatsapp i {
    width: 15px;
    height: 15px;
}
