/* ============================================================
   SMARTCLINIC - TOOLBAR + BOTOES + ABAS + MODAIS
   Padrao visual unificado para todas as telas de cadastro
   ============================================================ */

/* ============================================================
   TOOLBAR DE ACOES
   ============================================================ */

.toolbar {
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

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

.toolbar-right {
    margin-left: auto;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* ============================================================
   BOTOES PADRAO
   ============================================================ */

.btn-padrao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.2;
    transition: all 0.3s ease;
}

.btn-padrao:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.12);
}

.btn-padrao:active {
    transform: translateY(0);
}

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

.btn-padrao svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

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

.btn-editar      { background: #c47b1c; color: #fff; }
.btn-editar:hover{ background: #a86815; 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-excluir      { background: #b03a3a; color: #fff; }
.btn-excluir:hover{ background: #8f2e2e; 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; }

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

/* ============================================================
   ABAS (TABS)
   ============================================================ */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 0;
}

.tab-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-soft);
    border: 0;
    border-radius: 10px 10px 0 0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    position: relative;
    bottom: -1px;
    border-bottom: 2px solid transparent;
}

.tab-item:hover {
    background: var(--brand-light);
    color: var(--brand-dark);
}

.tab-item.is-active {
    background: var(--brand);
    color: #fff;
    border-bottom-color: var(--brand);
}

.tab-item .tab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

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

.tab-item.is-active .tab-dot.ativo   { background: #86efac; }
.tab-item.is-active .tab-dot.inativo { background: #fca5a5; }

.tab-content {
    display: none;
}

.tab-content.is-active {
    display: block;
}

/* ============================================================
   MODO VISUALIZACAO / EDICAO
   ============================================================ */

.campo-empresa:disabled,
.campo-empresa[disabled] {
    background: var(--bg-soft);
    cursor: not-allowed;
    color: var(--text-soft);
}

.campo-empresa:enabled {
    background: var(--card);
    cursor: text;
    color: var(--text);
}

.campo-restrito[disabled]::after {
    content: " 🔒";
}

.modo-edicao {
    border-left: 4px solid #c47b1c;
    animation: pulse-border 1.5s ease-in-out;
}

.modo-visualizacao {
    border-left: 4px solid transparent;
}

@keyframes pulse-border {
    0%, 100% { border-left-color: #c47b1c; }
    50%      { border-left-color: #f0c674; }
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    text-transform: capitalize;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-muted   { background: var(--bg-soft);       color: var(--muted); }

/* ============================================================
   MODAIS
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.is-open {
    display: flex;
}

.modal-box {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modal-in 0.2s ease-out;
}

.modal-box.is-lg { max-width: 860px; }
.modal-box.is-sm { max-width: 400px; }

@keyframes modal-in {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--brand);
    color: #fff;
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-header.is-success { background: var(--success); }
.modal-header.is-danger  { background: var(--danger); }
.modal-header.is-warning { background: var(--warning); }

.modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: transparent;
    border: 0;
    color: inherit;
    opacity: 0.8;
    cursor: pointer;
    padding: 4px;
    line-height: 0;
    border-radius: 4px;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.modal-close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.15);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 14px;
    line-height: 1.55;
}

.modal-body p { margin-bottom: 10px; }

.modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================================================
   FORMULARIO
   ============================================================ */

.form-section {
    margin-bottom: 24px;
}

.form-section-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--brand);
    font-weight: 700;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

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

    .btn-padrao {
        padding: 7px 12px;
        font-size: 12px;
    }

    .btn-padrao-label {
        display: none;
    }

    .btn-padrao svg {
        width: 16px;
        height: 16px;
    }

    .toolbar-right {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }

    .tab-item {
        padding: 10px 14px;
        font-size: 12px;
    }

    .modal-box {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .btn-padrao {
        padding: 6px 10px;
    }

    .tab-item {
        padding: 8px 10px;
        font-size: 11px;
    }
}
