/* =========================================
   LAUDOK! — Site Styles
   Century Gothic + Tailwind CSS 4 overrides
   ========================================= */

:root {
  /* ── Core Brand ── */
  --color-primary-dark:   #123351;   /* Sidebar fundo */
  --color-primary-brand:  #0076bf;   /* Títulos principais */
  --color-primary-action: #00a4eb;   /* Botões azuis brilhantes (Revisar, Mais Novo) */
  --color-primary-hover:  #314d68;   /* Hover da sidebar / tons escuros secundarios */

  /* ── Backgrounds & Surfaces ── */
  --color-bg-page:        #f7f9fa;   /* Fundo geral da listagem e cards de fundo */
  --color-surface:        #ffffff;   /* Fundo de cards brancos */
  --color-bg-disabled:    #d8dee3;   /* Fundo do botão desativado "Revisado" */
  
  /* ── Neutral / UI Texts ── */
  --color-text-dark:      #5d6d7e;   /* Cor chumbo dos subtítulos */
  --color-text-muted:     #92a4b3;   /* Cor de detalhes */
  --color-border-light:   #e4e9ed;   /* Bordas redondadas dos cards (clarinho) */
  --color-border-input:   #d1d5db;   /* Default input border */

  /* ── Status Colors ── */
  --color-status-success: #44b679;   /* Bolinha Verde */
  --color-status-warning: #e7bc4e;   /* Bolinha Amarela */
  --color-status-danger:  #e15554;   /* Bolinha Vermelha */
  --color-status-muted:   #aeb9c3;   /* Texto Botão Revisado */

  /* Cores de transição para o Tailwind _Layout / UI elements */
  --color-sidebar:        var(--color-primary-dark);
  --color-sidebar-text:   #ffffff;
  --color-sidebar-hover:  #20476e; 
  --color-sidebar-active: #0c2338;
}

/* Scrollbar styling for sidebar */
#sidebar ::-webkit-scrollbar {
    width: 6px;
}
#sidebar ::-webkit-scrollbar-track {
    background: transparent;
}
#sidebar ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}
#sidebar ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.16);
}
#sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

/* Modal backdrop animation */
.modal-overlay {
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease;
}
.modal-overlay .modal-content {
    animation: slideIn 0.25s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* Dropdown chevron rotation */
.sidebar-dropdown.open > a .fa-chevron-right {
    transform: rotate(90deg);
}

/* Active nav item highlight — modern indicator bar */
#sidebar a.active-link {
    background-color: rgba(255, 255, 255, 0.06);
    color: #ffffff !important;
    position: relative;
}
#sidebar a.active-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--color-primary-action);
    border-radius: 0 2px 2px 0;
}
#sidebar a.active-link i {
    color: var(--color-primary-action);
}
/* Submenu active link — no left bar (parent already shows context) */
#sidebar .sidebar-dropdown ul a.active-link::before {
    display: none;
}
#sidebar .sidebar-dropdown ul a.active-link {
    background-color: rgba(0, 164, 235, 0.12);
    color: #ffffff !important;
}
#sidebar .sidebar-dropdown ul a.active-link i {
    color: var(--color-primary-action);
}

/* Collapsible sections — usa grid-template-rows trick (animação suave em altura)
   sem precisar calcular scrollHeight via JS. Suporte: Chrome 117+, Safari 16.4+,
   Firefox 124+ (suficiente para o público interno). */
.section-body {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.3s ease;
}
.collapsible-section[data-collapsed="true"] > .section-body {
    grid-template-rows: 0fr;
}
.section-body-inner {
    overflow: hidden;
    min-height: 0;
}
.section-header {
    cursor: pointer;
    user-select: none;
}
.section-chevron {
    margin-left: auto;
    color: var(--color-text-muted);
    transition: transform 0.3s ease;
    font-size: 14px;
}
.collapsible-section[data-collapsed="true"] > .section-header .section-chevron {
    transform: rotate(-90deg);
}

/* Print styles - hide sidebar/header */
@media print {
    #sidebar, #sidebarToggle, #sidebarOverlay, footer {
        display: none !important;
    }
    .ml-\[250px\] {
        margin-left: 0 !important;
    }
}

/* Field priority indicators */
.priority-dot {
    font-size: 8px;
    margin-right: 5px;
    vertical-align: middle;
}
.priority-obrigatorio { color: #ffd745; }
.priority-complementar { color: #45d7a0; }
.priority-suplementar { color: #4588d7; }

/* Table base styling (reusable) */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    background-color: var(--color-sidebar);
    color: var(--color-surface);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 0.9rem;
}
.data-table tbody tr:hover {
    background-color: var(--color-bg-page);
}

/* Button utilities */
.btn-primary {
    background-color: var(--color-primary-brand);
    color: var(--color-surface);
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-primary:hover {
    background-color: var(--color-primary-action);
}
.btn-primary:disabled,
.btn-primary.is-disabled {
    background-color: var(--color-text-muted, #9ca3af);
    cursor: not-allowed;
    opacity: 0.6;
}
.btn-primary:disabled:hover,
.btn-primary.is-disabled:hover {
    background-color: var(--color-text-muted, #9ca3af);
}
/* Botao secundario (Cancelar, Voltar, acoes de apoio).
   ATENCAO: existe tambem o combo Bootstrap `.btn.btn-secondary` mais abaixo.
   Esta regra e a versao STANDALONE (usada como `class="btn-secondary"`, sem o
   `btn`), que antes nao existia — os botoes ficavam sem estilo nenhum, com
   aparencia de texto solto. Declarada ANTES do bloco `.btn` de proposito: assim
   os elementos que usam o combo `btn btn-secondary` continuam pegando o
   padding/border do `.btn` e a cor do `.btn.btn-secondary`, sem alteracao. */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: var(--color-surface);
    color: var(--color-text-dark);
    padding: 8px 18px;
    border: 1px solid var(--color-border-input);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.4;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-secondary:hover {
    background-color: var(--color-bg-page);
    border-color: var(--color-text-muted);
}
.btn-secondary:disabled,
.btn-secondary.is-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.btn-danger {
    background-color: var(--color-status-danger);
    color: var(--color-surface);
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-danger:hover {
    background-color: #c94b4b; /* slightly darker red for hover */
}
.btn-outline {
    background: transparent;
    color: var(--color-primary-brand);
    padding: 8px 18px;
    border: 2px solid var(--color-primary-brand);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-outline:hover {
    background-color: var(--color-primary-brand);
    color: var(--color-surface);
}

/* Card utility */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    padding: 20px;
}

/* Form input styling */
.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border-input);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    font-family: inherit;
}
.form-input:focus {
    outline: none;
    border-color: var(--color-primary-brand);
    box-shadow: 0 0 0 3px rgba(0, 118, 191, 0.15); /* Using primary brand rgba */
}

.form-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-dark);
}

/* Validation error */
.field-validation-error {
    color: var(--color-status-danger);
    font-size: 0.8rem;
    margin-top: 2px;
}
.input-validation-error {
    border-color: var(--color-status-danger) !important;
}

/* =========================================
   Bootstrap Compatibility Layer
   Provides legacy Bootstrap class definitions
   for partial views not yet migrated to Tailwind.
   ========================================= */

/* ── Grid System ── */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -8px;
    margin-right: -8px;
}
.row > [class*="col-sm-"],
.row > [class*="col "] ,
.row > .col {
    padding-left: 8px;
    padding-right: 8px;
    margin-bottom: 12px;
}

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

/* Responsive: stack on mobile */
@media (max-width: 575.98px) {
    .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4,
    .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8,
    .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ── Panels ── */
.panel-body {
    padding: 16px;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 16px;
}

.control-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-dark);
}

.form-control {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border-input);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background-color: var(--color-surface);
    color: #333;
    box-sizing: border-box;
}
.form-control:focus {
    outline: none;
    border-color: var(--color-primary-brand);
    box-shadow: 0 0 0 3px rgba(0, 118, 191, 0.15);
}
select.form-control {
    appearance: auto;
    cursor: pointer;
}
textarea.form-control {
    resize: vertical;
}

/* ── Form Check (Bootstrap checkboxes) ── */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.form-check-input {
    accent-color: var(--color-primary-brand);
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.form-check-label {
    font-size: 0.9rem;
    color: var(--color-text-dark);
    cursor: pointer;
}
.form-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-dark);
}

/* ── Buttons (Bootstrap-style class combos) ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}
.btn.btn-primary {
    background-color: var(--color-primary-brand);
    color: var(--color-surface);
}
.btn.btn-primary:hover {
    background-color: var(--color-primary-action);
}
.btn.btn-secondary {
    background-color: #6c757d;
    color: var(--color-surface);
}
.btn.btn-secondary:hover {
    background-color: #5a6268;
}
.btn.btn-outline-secondary {
    background: transparent;
    color: #6c757d;
    border: 1px solid #6c757d;
}
.btn.btn-outline-secondary:hover {
    background: #6c757d;
    color: var(--color-surface);
}
.btn.btn-danger {
    background-color: var(--color-status-danger);
    color: var(--color-surface);
}
.btn.btn-danger:hover {
    background-color: #c94b4b;
}

/* Small button variants for table actions */
.editButton,
.addButton {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 5px;
}

/* ── Modal Footer ── */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px;
    border-top: 1px solid var(--color-border-light);
    background-color: var(--color-bg-page);
    border-radius: 0 0 8px 8px;
}

/* ── Checkbox Containers (Tower Fachada etc.) ── */
.checkContainer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}
.checkFachadaT,
.checkServico {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--color-text-dark);
}
.checkFachadaT input[type="checkbox"],
.checkServico input[type="checkbox"] {
    accent-color: var(--color-primary-brand);
    width: 15px;
    height: 15px;
}

/* ── Misc Input classes ── */
.numericField {
    text-align: right;
}
.filterControl {
    cursor: pointer;
}

/* ── Searchable Select (combo com busca) ── */
.ss-wrap {
    position: relative;
}
select.ss-native {
    position: absolute !important;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    margin: 0;
}
.ss-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}
.ss-control:focus,
.ss-control.ss-open {
    outline: none;
    border-color: var(--color-primary-brand, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}
.ss-control .ss-value {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex: 1 1 auto;
}
.ss-control .ss-value.ss-placeholder {
    color: #9ca3af;
}
.ss-control .ss-caret {
    font-size: 11px;
    color: #6b7280;
    transition: transform 0.15s ease;
    flex: 0 0 auto;
}
.ss-control.ss-open .ss-caret {
    transform: rotate(180deg);
}

.ss-panel {
    position: fixed;
    z-index: 10000;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    max-height: 320px;
    overflow: hidden;
}
.ss-panel.hidden {
    display: none;
}
.ss-search-wrap {
    position: relative;
    padding: 6px;
    border-bottom: 1px solid #eef0f2;
    flex: 0 0 auto;
}
.ss-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #9ca3af;
    pointer-events: none;
}
.ss-search {
    width: 100%;
    padding: 6px 8px 6px 30px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
}
.ss-search:focus {
    border-color: var(--color-primary-brand, #2563eb);
}
.ss-list {
    overflow-y: auto;
    padding: 4px 0;
}
.ss-group {
    padding: 6px 12px 2px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #9ca3af;
}
.ss-item {
    padding: 7px 12px;
    font-size: 14px;
    cursor: pointer;
    white-space: normal;
}
.ss-item.hidden {
    display: none;
}
.ss-item:hover,
.ss-item.ss-active {
    background: #f1f5f9;
}
.ss-item.ss-selected {
    font-weight: 600;
    color: var(--color-primary-brand, #2563eb);
}
.ss-empty {
    padding: 10px 12px;
    font-size: 13px;
    color: #9ca3af;
    text-align: center;
}
.checkBoxInput {
    accent-color: var(--color-primary-brand);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ── d-flex / d-none Bootstrap utilities ── */
.d-flex { display: flex; }
.d-none { display: none; }
.gap-2 { gap: 8px; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.mb-3 { margin-bottom: 16px; }

/* ── Text helpers ── */
.text-danger { color: var(--color-status-danger); }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}