/* =============================================================
   ERLSoft — Componentes reutilizáveis
   Carregado globalmente via includes/header.php
   ============================================================= */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    --md-blue:       #2563eb;
    --md-blue-light: #eff6ff;
    --md-blue-mid:   #bfdbfe;
    --md-slate:      #1e293b;
    --md-muted:      #64748b;
    --md-border:     #e2e8f0;
    --md-card-bg:    #ffffff;
    --md-radius:     14px;
    --md-shadow:     0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
    --md-shadow-lg:  0 8px 32px rgba(37,99,235,.12);
}
[data-bs-theme="dark"] {
    --md-blue-light: #1e293b;
    --md-blue-mid:   #1e3a5f;
    --md-slate:      #f1f5f9;
    --md-muted:      #94a3b8;
    --md-border:     #334155;
    --md-card-bg:    #1e293b;
    --md-shadow:     0 1px 3px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.2);
}

/* ── Layout wrapper ────────────────────────────────────────── */
.md-wrapper {
    max-width: 960px;
    margin: 0 auto;
    padding-bottom: 3rem;
}

/* ── Hero banner ───────────────────────────────────────────── */
.md-hero {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-radius: var(--md-radius);
    padding: 2rem 2.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.md-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}
.md-hero-icon {
    width: 68px; height: 68px;
    border-radius: 16px;
    background: rgba(255,255,255,.18);
    border: 1.5px solid rgba(255,255,255,.28);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.9rem; color: #fff;
    flex-shrink: 0;
    position: relative; z-index: 1;
}
.md-hero-text { position: relative; z-index: 1; }
.md-hero-text h4   { color: #fff; font-weight: 700; font-size: 1.3rem; margin-bottom: .2rem; }
.md-hero-text p,
.md-hero-text span { color: rgba(255,255,255,.75); font-size: .875rem; margin: 0; }
.md-hero-badge {
    display: inline-flex; align-items: center; gap: .4rem;
    background: rgba(255,255,255,.2); color: #fff;
    font-size: .75rem; font-weight: 600;
    padding: .25rem .85rem; border-radius: 999px; margin-top: .5rem;
    border: 1px solid rgba(255,255,255,.28);
}

/* ── Section cards ─────────────────────────────────────────── */
.md-card {
    background: var(--md-card-bg);
    border: 1px solid var(--md-border);
    border-radius: var(--md-radius);
    box-shadow: var(--md-shadow);
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.md-card-header {
    display: flex; align-items: center; gap: .65rem;
    padding: .9rem 1.5rem;
    border-bottom: 1px solid var(--md-border);
    background: var(--md-blue-light);
}
.md-header-icon {
    width: 30px; height: 30px; border-radius: 8px;
    background: #2563eb; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; flex-shrink: 0;
}
.md-card-header h6 {
    margin: 0; font-weight: 700; font-size: .8rem;
    color: var(--md-slate);
    text-transform: uppercase; letter-spacing: .06em;
}
.md-card-body { padding: 1.5rem; }

/* ── Form fields ───────────────────────────────────────────── */
.md-field label {
    font-size: .74rem; font-weight: 700; color: var(--md-muted);
    text-transform: uppercase; letter-spacing: .06em;
    margin-bottom: .35rem; display: block;
}
.md-field .input-group-text {
    background: var(--md-blue-light);
    border-color: var(--md-border);
    color: #2563eb; font-size: .82rem;
}
.md-field .form-control,
.md-field .form-select {
    border-color: var(--md-border); font-size: .9rem;
    transition: border-color .2s, box-shadow .2s;
}
.md-field .form-control:focus,
.md-field .form-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.md-field .form-control:disabled,
.md-field .form-control[readonly],
.md-field .form-select:disabled {
    background: var(--md-blue-light);
    color: var(--md-muted); cursor: default;
}

/* ── Select2 dentro de input-group ────────────────────────── */
.input-group .select2-container {
    flex: 1 1 auto;
    width: 1% !important;
    min-width: 0;
}
.input-group .select2-selection--single {
    height: 38px;
    border-radius: 0 .375rem .375rem 0 !important;
    border-color: var(--md-border) !important;
    display: flex;
    align-items: center;
}
.input-group .select2-selection--single .select2-selection__rendered {
    line-height: 1;
    padding-left: .75rem;
    color: inherit;
}
.input-group .select2-selection--single .select2-selection__arrow {
    height: 36px;
    top: 1px;
}
.input-group .select2-container--open .select2-selection--single {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ── Botões ────────────────────────────────────────────────── */
.btn-erlsoft-primary,
.btn-md-save {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: none; color: #fff;
    padding: .65rem 2rem; border-radius: 10px;
    font-weight: 700; font-size: .9rem; letter-spacing: .02em;
    box-shadow: 0 4px 14px rgba(37,99,235,.35);
    transition: transform .15s, box-shadow .15s;
    display: inline-block; cursor: pointer;
    text-decoration: none;
}
.btn-erlsoft-primary:hover,
.btn-md-save:hover  { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(37,99,235,.45); color: #fff; }
.btn-erlsoft-primary:active,
.btn-md-save:active { transform: translateY(0);    box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.btn-erlsoft-primary:disabled,
.btn-md-save:disabled { opacity: .65; transform: none; pointer-events: none; }

.btn-erlsoft-secondary {
    background: transparent;
    border: 1.5px solid var(--md-border); color: var(--md-muted);
    padding: .65rem 1.5rem; border-radius: 10px;
    font-weight: 600; font-size: .9rem;
    transition: border-color .2s, color .2s, background .2s;
    display: inline-block; cursor: pointer;
}
.btn-erlsoft-secondary:hover  { border-color: #2563eb; color: #2563eb; }
.btn-erlsoft-secondary:active { background: var(--md-blue-light); }
.btn-erlsoft-secondary:disabled { opacity: .65; pointer-events: none; }

/* ── Célula de tabela multi-linha (hierarquia visual) ─────────
   Uso: coluna que precisa exibir info hierárquica em uma célula
   (ex: medicamento+apresentação+fabricante, paciente+CPF).
   .cell-multi-titulo é obrigatório; -detalhe e -suave são opcionais.
   max-width/padding específicos de coluna ficam de override na view. */
.cell-multi {
    white-space: normal;
    line-height: 1.3;
}
.cell-multi-titulo {
    font-weight: 500;
}
.cell-multi-detalhe {
    font-size: 0.85em;
    color: var(--bs-body-color, #495057);
    opacity: 0.85;
    margin-top: 1px;
}
.cell-multi-suave {
    font-size: 0.78em;
    color: var(--bs-secondary-color, #6c757d);
    margin-top: 2px;
}

/* ── Responsividade ────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .md-hero { padding: 1.25rem 1.25rem; gap: 1rem; }
    .md-hero-icon { width: 52px; height: 52px; font-size: 1.4rem; border-radius: 12px; }
    .md-hero-text h4 { font-size: 1.1rem; }
    .md-card-body { padding: 1rem; }
}
