/* ============================================================
   SMARTCLINIC - LAYOUT ERP (adaptado)
   Baseado em dev.smarthosting.com.br/transportadoras.php
   Cores adaptadas para o verde #2f5f57
   ============================================================ */

/* ============================================================
   MAIN CONTENT
   ============================================================ */



@media (max-width: 768px) {
    
}

/* ============================================================
   TITULO DA PAGINA
   ============================================================ */

.page-title {
    margin: 0 0 24px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-title .page-icon {
    font-size: 22px;
    color: var(--brand);
    flex-shrink: 0;
    line-height: 1;
}

/* ============================================================
   TOOLBAR (bloco separado entre titulo e primeiro card)
   ============================================================ */

.toolbar {
    background: var(--card);
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar button {
    padding: 8px 16px;
    border: 0;
    border-radius: 8px;
    font-family: var(--font-family);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.toolbar button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.toolbar button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.toolbar button svg,
.toolbar a svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}



.toolbar .toolbar-sep {
    width: 1px;
    height: 24px;
    background: var(--border-soft);
    margin: 0 4px;
}

/* Cores dos botoes (adaptadas ao verde) */
.btn-novo      { background: #2f7d5b; color: #fff; }
.btn-novo:hover{ background: #266547; color: #fff; }

.btn-pesquisar      { background: #2a5c8a; color: #fff; }
.btn-pesquisar:hover{ background: #1f4a72; color: #fff; }

.btn-editar      { background: #c47b1c; color: #fff; }
.btn-editar:hover{ background: #a86815; color: #fff; }

.btn-excluir      { background: #b03a3a; color: #fff; }
.btn-excluir:hover{ background: #8f2e2e; color: #fff; }

.btn-salvar      { background: var(--brand); color: #fff; }
.btn-salvar:hover{ background: var(--brand-dark); color: #fff; }

.btn-cancelar      { background: #6c757d; color: #fff; }
.btn-cancelar:hover{ background: #5a6268; color: #fff; }

.btn-imprimir      { background: #8a4a8a; color: #fff; }
.btn-imprimir:hover{ background: #6f3a6f; color: #fff; }

.btn-sair      { background: #1b3b3a; color: #fff; }
.btn-sair:hover{ background: #0f2a29; color: #fff; }

.btn-api      { background: #2a5c8a; color: #fff; }
.btn-api:hover{ background: #1f4a72; color: #fff; }

/* ============================================================
   CARDS (blocos de formulario)
   ============================================================ */

.card {
    background: var(--card);
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.06);
    margin-bottom: 25px;
    overflow: hidden;
}

.card-header {
    background: var(--card);
    border-bottom: 1px solid #eee;
    padding: 20px 25px;
    border-radius: 15px 15px 0 0;
    font-weight: 700;
    font-size: 16px;
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

.card-header .card-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

.card-header .badge {
    margin-left: auto;
    flex-shrink: 0;
}

.card-header .card-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.card-body {
    padding: 25px;
}

/* ============================================================
   FORMULARIOS
   ============================================================ */

.form-label {
    font-weight: 500;
    color: #555;
    margin-bottom: 5px;
    font-size: 13px;
    display: block;
}

.form-control,
.form-select {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    width: 100%;
    font-family: inherit;
    background: var(--card);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 0.2rem rgba(47, 95, 87, 0.1);
}

.form-control:disabled,
.form-select:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    color: #666;
}

/* ============================================================
   GRID (Bootstrap-like)
   ============================================================ */

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -8px;
}

.row > [class*="col-"] {
    padding: 0 8px;
}

.col-md-1  { flex: 0 0 8.3333%; max-width: 8.3333%; }
.col-md-2  { flex: 0 0 16.6667%; max-width: 16.6667%; }
.col-md-3  { flex: 0 0 25%; max-width: 25%; }
.col-md-4  { flex: 0 0 33.3333%; max-width: 33.3333%; }
.col-md-5  { flex: 0 0 41.6667%; max-width: 41.6667%; }
.col-md-6  { flex: 0 0 50%; max-width: 50%; }
.col-md-7  { flex: 0 0 58.3333%; max-width: 58.3333%; }
.col-md-8  { flex: 0 0 66.6667%; max-width: 66.6667%; }
.col-md-9  { flex: 0 0 75%; max-width: 75%; }
.col-md-10 { flex: 0 0 83.3333%; max-width: 83.3333%; }
.col-md-12 { flex: 0 0 100%; max-width: 100%; }

.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }

@media (max-width: 768px) {
    .row > [class*="col-md-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ============================================================
   TABELAS
   ============================================================ */

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.table th {
    background: #f1f3f9;
    color: #333;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    white-space: nowrap;
    padding: 10px 12px;
    text-align: left;
    border: 0;
}

.table td {
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    font-size: 13px;
    padding: 10px 12px;
}

.table tr { cursor: pointer; }
.table tr.row-selected { background: #e8f0ed !important; }
.table tbody tr:hover { background: #f8fbfa; }

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================================
   BADGES DE STATUS
   ============================================================ */

.badge-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
    line-height: 1.2;
}

.badge-ativo   { background: #e8f5e9; color: #2f7d5b; }
.badge-inativo { background: #ffebee; color: #b03a3a; }
.badge-info    { background: #e3f2fd; color: #2a5c8a; }
.badge-warning { background: #fff8e1; color: #a06f1c; }
.badge-success { background: #e8f5e9; color: #2f7d5b; }
.badge-muted   { background: #f5f5f5; color: #999; }

/* ============================================================
   INPUT COM BOTAO (WhatsApp)
   ============================================================ */

.input-com-botao {
    display: flex;
    gap: 4px;
    align-items: stretch;
}

.input-com-botao .form-control {
    flex: 1;
}

.input-com-botao .btn-icone {
    padding: 8px 12px;
    flex-shrink: 0;
}

/* ============================================================
   RADIO GROUP
   ============================================================ */

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 6px 0;
}

.radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
}

/* ============================================================
   BLOCO BLOQUEADO (modo visualizacao)
   ============================================================ */

.bloco-bloqueado {
    opacity: 0.85;
}

.bloco-bloqueado .card-header {
    color: #888;
}

.bloco-bloqueado .form-control:disabled,
.bloco-bloqueado .form-select:disabled {
    background: #f9f9f9;
}

/* ============================================================
   RESPONSIVIDADE
   ============================================================ */

@media (max-width: 768px) {
    .toolbar {
        padding: 12px 14px;
        gap: 6px;
    }

    .toolbar button {
        padding: 7px 12px;
        font-size: 12px;
    }

    .toolbar button span {
        display: none;
    }

    .toolbar button svg {
        width: 16px;
        height: 16px;
    }

    

    .card-header {
        padding: 16px 20px;
        font-size: 15px;
    }

    .card-body {
        padding: 18px;
    }
}


   TABS (nav-tabs) - padrao ERP
   ============================================================ */

.nav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border: none;
    margin-bottom: 20px;
    padding: 0;
    list-style: none;
}

.nav-tabs .nav-item {
    list-style: none;
}

.nav-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    border-radius: 10px 10px 0 0;
    padding: 12px 20px;
    font-family: inherit;
    font-weight: 600;
    color: #888;
    background: #e8eaf6;
    font-size: 13px;
    cursor: pointer;
    transition: 0.3s;
}

.nav-tabs .nav-link:hover {
    background: var(--brand-light);
    color: var(--brand-dark);
}

.nav-tabs .nav-link.active {
    color: white;
    background: var(--brand);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.ativo   { background: #4ade80; }
.status-dot.inativo { background: #f87171; }

.nav-tabs .nav-link.active .status-dot.ativo   { background: #86efac; }
.nav-tabs .nav-link.active .status-dot.inativo { background: #fca5a5; }


   HORARIOS COMPACTOS (tela de Unidades)
   ============================================================ */

.horarios-compactos {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 420px;
}

.horario-compacto-linha {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.horario-compacto-linha .horario-aberto {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

.horario-dia-nome {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    width: 70px;
    flex-shrink: 0;
}

.horario-compacto-linha input[type="time"].form-control-sm {
    font-size: 13px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 110px;
    flex-shrink: 0;
    background: var(--card);
    color: var(--text);
    font-family: inherit;
}

.horario-compacto-linha input[type="time"].form-control-sm:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.horario-sep {
    font-size: 12px;
    color: var(--muted);
    flex-shrink: 0;
}



/* ============================================================
   HORARIO DE FUNCIONAMENTO - TELA DE UNIDADES
   Layout com colunas fixas, tudo alinhado
   ============================================================ */

.horarios-lista {
    display: block;
    max-width: 520px;
    padding: 4px 0;
}

.horario-item {
    display: grid !important;
    grid-template-columns: 24px 90px 110px 30px 110px;
    align-items: center !important;
    column-gap: 8px;
    padding: 8px 6px;
    border-bottom: 1px solid #f0f0f0;
}

.horario-item:last-child {
    border-bottom: 0;
}

.horario-item:hover {
    background: #fafbfa;
}

/* Checkbox */
.horario-item .horario-aberto {
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer;
    justify-self: center;
    accent-color: var(--brand);
}

/* Nome do dia */
.horario-item .horario-dia {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    line-height: 1.4;
}

/* Inputs de hora */
.horario-item .horario-inicio,
.horario-item .horario-fim {
    width: 110px !important;
    height: 32px !important;
    padding: 4px 8px !important;
    font-size: 13px !important;
    font-family: inherit !important;
    color: var(--text) !important;
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    line-height: 1.2 !important;
    box-sizing: border-box !important;
    outline: none !important;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;
}

.horario-item .horario-inicio:focus,
.horario-item .horario-fim:focus {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 3px var(--brand-light) !important;
}

.horario-item .horario-inicio:disabled,
.horario-item .horario-fim:disabled {
    background: #f5f5f5 !important;
    color: #999 !important;
    cursor: not-allowed;
    border-color: #e5e5e5 !important;
}

/* "as" */
.horario-item .horario-ate {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    user-select: none;
}

/* Ajustes mobile */
@media (max-width: 600px) {
    .horario-item {
        grid-template-columns: 24px 70px 1fr 24px 1fr;
        column-gap: 6px;
    }
    .horario-item .horario-dia {
        font-size: 12px;
    }
    .horario-item .horario-inicio,
    .horario-item .horario-fim {
        width: 100% !important;
        font-size: 12px !important;
        padding: 4px 6px !important;
        height: 30px !important;
    }
}

/* ============================================================
   CHECKBOX LIST (N:N)
   ============================================================ */

.checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 8px 0;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fafbfa;
}

.checkbox-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
    min-width: 45%;
}

.checkbox-item:hover {
    background: rgba(47, 95, 87, 0.05);
}

.checkbox-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--brand);
    flex-shrink: 0;
}

/* ============================================================
   FOTO UPLOAD
   ============================================================ */

.foto-upload {
    width: 140px;
    height: 140px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
    background: #fafbfa;
}

.foto-upload:hover {
    border-color: var(--brand);
    background: var(--brand-light);
}

.foto-upload img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.foto-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
}

.foto-placeholder span {
    font-size: 32px;
    line-height: 1;
    color: var(--brand);
    opacity: 0.6;
}

/* ============================================================
   CHECKBOX LIST GRID (Servicos)
   ============================================================ */

.checkbox-list-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px 16px;
    max-height: none;
    overflow: visible;
}

.checkbox-list-grid .checkbox-item {
    min-width: auto;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.checkbox-list-grid .checkbox-item:hover {
    background: var(--brand-light);
    border-color: var(--brand);
}

.checkbox-list-grid .checkbox-item input:checked + span {
    font-weight: 600;
    color: var(--brand-dark);
}
