/* ═══════════════════════════════════════════════════════════
   COMPONENTS.CSS — Botões, Cards, Formulários, Modais, Tabelas
═══════════════════════════════════════════════════════════ */

/* ─── BOTÕES ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-gold {
    background: linear-gradient(135deg, #d4af37, #b58b00);
    color: white;
    box-shadow: var(--shadow-gold);
}
.btn-gold:hover {
    box-shadow: 0 6px 24px rgba(181, 139, 0, 0.35);
    transform: translateY(-1px);
    color: white;
}
.btn-gold:active { transform: translateY(0); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--gold-dark);
    color: var(--gold-dark);
}
.btn-outline:hover {
    background: var(--gold-subtle);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--cream-border);
}
.btn-ghost:hover {
    background: var(--cream-card);
    color: var(--text-body);
    border-color: var(--text-light);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1.5px solid rgba(192, 57, 43, 0.2);
}
.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
    font-size: 1rem;
}

/* ─── CARDS ─── */
.card {
    background: var(--cream-card);
    border: 1px solid var(--cream-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-gold-accent {
    border-left: 3px solid var(--gold-primary);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--cream-border);
}
.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.card-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--gold-dark);
    line-height: 1;
}

.stat-sub {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* ─── FORMULÁRIOS ─── */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--cream-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--text-dark);
    background: white;
    transition: var(--transition-fast);
    outline: none;
}
.form-control:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
}
.form-control::placeholder { color: var(--text-light); }

.form-control-lg {
    padding: 13px 16px;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23b8a990' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
    appearance: none;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 4px;
}

.form-error {
    font-size: 0.8125rem;
    color: var(--danger);
    margin-top: 4px;
}

/* ─── TABELAS ─── */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--cream-border);
    background: var(--cream-card);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: var(--cream-bg);
    border-bottom: 1px solid var(--cream-border);
    white-space: nowrap;
}

tbody td {
    padding: 14px 16px;
    font-size: 0.9rem;
    color: var(--text-body);
    border-bottom: 1px solid rgba(232, 226, 213, 0.6);
    vertical-align: middle;
}

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

tbody tr:hover td {
    background: rgba(245, 242, 235, 0.6);
}

/* ─── MODAL ─── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(29, 23, 15, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 900;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}
.modal-overlay.open {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--cream-card);
    border: 1px solid var(--cream-border);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.25s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--cream-border);
}
.modal-header h2 {
    font-size: 1.25rem;
    color: var(--text-dark);
}
.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--cream-bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover { background: var(--cream-border); color: var(--text-dark); }

.modal-footer {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--cream-border);
}

/* ─── TOAST / NOTIFICAÇÃO ─── */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: var(--text-dark);
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    animation: slideInLeft 0.3s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* ─── EMPTY STATE ─── */
.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    color: var(--text-muted);
}
.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.4;
}
.empty-state h4 {
    font-size: 1.1rem;
    margin-bottom: var(--space-sm);
    color: var(--text-body);
}
.empty-state p {
    font-size: 0.875rem;
    max-width: 300px;
    margin: 0 auto;
}

/* ─── LOADING SPINNER ─── */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--cream-border);
    border-top-color: var(--gold-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── DIVIDER ─── */
.divider {
    height: 1px;
    background: var(--cream-border);
    margin: var(--space-lg) 0;
}
.divider-gold {
    height: 2px;
    background: linear-gradient(to right, transparent, var(--gold-primary), transparent);
    margin: var(--space-lg) 0;
}

/* ─── AVATAR ─── */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gold-subtle);
    border: 2px solid var(--gold-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--gold-dark);
    font-size: 1rem;
    overflow: hidden;
    flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.3rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.8rem; }

/* ─── STATUS SESSÃO ─── */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.status-agendada  { background: var(--info-bg);    color: var(--info); }
.status-realizada { background: var(--success-bg); color: var(--success); }
.status-cancelada { background: var(--danger-bg);  color: var(--danger); }
.status-faltou    { background: var(--warning-bg); color: var(--warning); }

/* ─── LAYOUT E ESTRUTURA DO DASHBOARD ─── */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
}

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar-logo {
    height: 40px;
    object-fit: contain;
}

.sidebar-menu {
    list-style: none;
    padding: var(--space-md) 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-item {
    margin: 4px var(--space-md);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-light);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-base);
    cursor: pointer;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: var(--gold-light);
}

.sidebar-item.active .sidebar-link {
    background: var(--sidebar-active);
    color: var(--gold-primary);
    border-left: 3px solid var(--gold-primary);
    padding-left: 13px;
}

.sidebar-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--sidebar-border);
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.header {
    height: var(--header-height);
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    padding: 0 var(--space-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
    backdrop-filter: blur(8px);
}

.header-title h1 {
    font-size: 1.5rem;
    margin-bottom: 0;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.875rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.content-body {
    padding: var(--space-xl);
    flex: 1;
    overflow-y: auto;
}

/* ─── SEÇÕES E TAB_PANELS ─── */
.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

/* ─── DADOS CLINICOS & CARDS ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stats-card {
    background: white;
    border: 1px solid var(--cream-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.stats-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--gold-subtle);
    color: var(--gold-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stats-info {
    flex: 1;
}

/* ─── VISUALIZAR FICHA DO PACIENTE ─── */
.patient-profile {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--space-xl);
    align-items: start;
}

.profile-card {
    background: white;
    border: 1px solid var(--cream-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.profile-avatar {
    margin: 0 auto var(--space-md) auto;
}

.profile-name {
    font-size: 1.25rem;
    margin-bottom: var(--space-xs);
}

.profile-status {
    margin-bottom: var(--space-md);
}

.profile-meta-list {
    list-style: none;
    text-align: left;
    border-top: 1px solid var(--cream-border);
    padding-top: var(--space-md);
    margin-top: var(--space-md);
}

.profile-meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    margin-bottom: var(--space-sm);
}

.profile-meta-item:last-child {
    margin-bottom: 0;
}

.profile-meta-label {
    color: var(--text-muted);
}

.profile-meta-value {
    font-weight: 600;
    color: var(--text-dark);
}

.details-card {
    background: white;
    border: 1px solid var(--cream-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.section-title-gold {
    font-family: var(--font-display);
    color: var(--gold-dark);
    font-size: 1.15rem;
    border-bottom: 1.5px solid var(--gold-border);
    padding-bottom: 6px;
    margin-bottom: var(--space-md);
    margin-top: var(--space-lg);
}

.section-title-gold:first-child {
    margin-top: 0;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-md);
}

.detail-item {
    font-size: 0.875rem;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.detail-value {
    color: var(--text-dark);
    font-weight: 500;
}

/* Modais Largos */
.modal-lg {
    max-width: 1200px;
    width: 95%;
}

.modal-xl {
    max-width: 1400px;
    width: 95%;
}

/* Campos de Filhos Dinâmicos */
.child-row {
    display: grid;
    grid-template-columns: 1fr 120px 45px;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    align-items: end;
}

/* Barra de ações rápidas nas tabelas */
.actions-cell {
    display: flex;
    gap: var(--space-xs);
    justify-content: flex-end;
}

/* ─── ACCESSIBILITY & READABILITY OVERRIDES (Vision Impaired & ADHD Friendly) ─── */
.modal-lg {
    max-width: 1500px !important;
    width: 95% !important;
}

.modal-xl {
    max-width: 1700px !important;
    width: 95% !important;
}

.modal {
    border: 3px solid var(--text-dark);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.form-label {
    font-size: 0.95rem !important; /* Larger label */
    font-weight: 700 !important; /* Bold */
    color: var(--text-dark) !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px !important;
}

.form-control {
    font-size: 1.15rem !important; /* Standard input font */
    font-weight: 600 !important;
    padding: 12px 16px !important;
    border: 2px solid var(--text-dark) !important;
    border-radius: var(--radius-sm) !important;
    background-color: #ffffff !important;
}

.form-control:focus {
    border-color: var(--gold-dark) !important;
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.25) !important;
}

.section-title-gold {
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    color: var(--gold-dark) !important;
    border-bottom: 3px solid var(--gold-primary) !important;
    padding-bottom: 6px !important;
    margin-top: 16px !important;
    margin-bottom: 12px !important;
    text-transform: uppercase;
}

.detail-label {
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.detail-value {
    font-size: 1.05rem !important; /* Standard display values */
    font-weight: 700 !important;
    color: var(--text-dark) !important;
}

.profile-name {
    font-size: 1.4rem !important;
    font-weight: 800 !important;
}

.profile-meta-item {
    font-size: 0.95rem !important;
    border-bottom: 1px dashed var(--cream-border);
    padding: 6px 0;
}

.profile-meta-label {
    font-weight: 600;
}

.profile-meta-value {
    font-size: 1.0rem;
    font-weight: 700;
}

.badge, .status-pill {
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    padding: 4px 10px !important;
    border: 2px solid currentColor !important;
}

/* Tables font size for visual comfort */
thead th {
    font-size: 0.9rem !important;
    font-weight: 800 !important;
    color: var(--text-dark) !important;
    padding: 14px !important;
    border-bottom: 3px solid var(--cream-border) !important;
}

tbody td {
    font-size: 1.05rem !important;
    font-weight: 600 !important;
    padding: 16px 14px !important;
    border-bottom: 2px solid var(--cream-border) !important;
}

#patient-search {
    font-size: 1.25rem !important;
    padding: 14px 18px !important;
    border: 2px solid var(--text-dark) !important;
}

/* Removed button accessibility overrides to restore elegant design */

/* Detailed Patient Profile Modal Layout */
.patient-profile {
    grid-template-columns: 300px 1fr !important;
    gap: 24px !important;
}

.details-card {
    padding: 16px !important;
}

.details-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 16px !important;
}

.section-title-gold {
    font-size: 1.25rem !important;
    margin-top: 16px !important;
    margin-bottom: 8px !important;
    padding-bottom: 4px !important;
}

.profile-card {
    padding: 16px !important;
}

.profile-meta-list {
    margin-top: 8px !important;
    padding-top: 8px !important;
}

.profile-meta-item {
    font-size: 0.95rem !important;
    padding: 4px 0 !important;
}

.profile-name {
    font-size: 1.4rem !important;
}


/* ADHD Friendly clean question display cards for Anamnese */
#anamnese-content .mb-md, #anamnese-content .mb-lg {
    background: #ffffff;
    border: 2px solid var(--cream-border);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md) !important;
    box-shadow: var(--shadow-sm);
}

#anamnese-content .mb-md:hover, #anamnese-content .mb-lg:hover {
    border-color: var(--gold-primary);
}

#anamnese-content .detail-label {
    font-size: 1.05rem !important;
    color: var(--text-dark) !important;
    margin-bottom: 10px !important;
    line-height: 1.4;
}

#anamnese-content p.text-dark {
    font-size: 1.2rem !important;
    font-weight: 500;
    line-height: 1.6;
    background: #fdfcf9 !important;
    border-left: 4px solid var(--gold-primary);
    padding: 12px 18px !important;
    margin-top: 8px !important;
    color: #1a1714 !important;
}


/* ─── BOTÕES DE AÇÃO DE SESSÃO (tabela de agenda) ─── */
.btn-confirm {
    background: linear-gradient(135deg, #d4af37, #b58b00);
    color: #ffffff;
    border: none;
    box-shadow: 0 2px 8px rgba(181, 139, 0, 0.25);
}
.btn-confirm:hover {
    background: linear-gradient(135deg, #b58b00, #8c6b00);
    box-shadow: 0 4px 16px rgba(181, 139, 0, 0.4);
    transform: translateY(-1px);
    color: #ffffff;
}

.btn-reschedule {
    background: transparent;
    color: var(--gold-dark);
    border: 1.5px solid var(--gold-dark);
}
.btn-reschedule:hover {
    background: var(--gold-subtle);
    transform: translateY(-1px);
}

.btn-remove {
    background: transparent;
    color: var(--danger);
    border: 1.5px solid rgba(192, 57, 43, 0.35);
}
.btn-remove:hover {
    background: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
}
