/* ===========================================================
   Estilos compartilhados das páginas de cadastro
   (Lojas, Funcionários e Calculadoras)
   Mantém consistência visual com as páginas de Férias.
   =========================================================== */

:root {
    --primary-blue: #6A8EAE;
    --primary-blue-dark: #5A7B9C;
    --secondary-light: #DCE2E8;
    --accent-green: #A8DADC;
    --text-dark: #333333;
    --text-muted: #6B7280;
    --background-light: #F8F9FA;
    --error-red: #dc3545;
    --error-red-dark: #C02C3C;
    --success-green: #28a745;
}

* { box-sizing: border-box; }

body {
    font-family: 'Open Sans', sans-serif;
    background-color: var(--background-light);
    margin: 0;
    padding: 0;
    color: var(--text-dark);
    line-height: 1.6;
}

main {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 24px 60px;
}

/* Cabeçalho da página */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 24px;
}

.page-header h1 {
    color: var(--primary-blue);
    font-size: 2.2em;
    font-weight: 700;
    margin: 0 0 6px 0;
}

.page-subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 1.02em;
    max-width: 640px;
}

.page-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.98em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

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

.btn-primary {
    background-color: var(--primary-blue);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(106, 142, 174, 0.25);
}

.btn-secondary {
    background-color: #fff;
    color: var(--primary-blue);
    border-color: var(--secondary-light);
}
.btn-secondary:hover:not(:disabled) {
    background-color: var(--background-light);
    border-color: var(--primary-blue);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--error-red);
    color: #fff;
}
.btn-danger:hover:not(:disabled) {
    background-color: var(--error-red-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(220, 53, 69, 0.25);
}

.btn-icon {
    font-size: 1.1em;
    line-height: 1;
}

/* Mensagem flutuante */
.mensagem {
    margin: 0 0 18px;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.98em;
}

.mensagem.sucesso {
    color: var(--success-green);
    background-color: #e6ffed;
    border: 1px solid #b2dfc9;
}

.mensagem.erro {
    color: var(--error-red);
    background-color: #ffe6e6;
    border: 1px solid #f5c6cb;
}

/* Filter bar */
.filter-bar {
    background-color: #fff;
    border-radius: 12px;
    padding: 18px 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    margin-bottom: 18px;
    display: flex;
    align-items: end;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 200px;
}

.filter-field--grow {
    flex: 1;
}

.filter-field label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.92em;
    letter-spacing: 0.01em;
}

.filter-field input[type="search"],
.filter-field input[type="text"],
.filter-field select {
    padding: 11px 14px;
    border: 1px solid var(--secondary-light);
    border-radius: 8px;
    background-color: #fff;
    font-size: 0.97em;
    color: var(--text-dark);
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-field input:focus,
.filter-field select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(106, 142, 174, 0.18);
}

/* Picker Mês/Ano: dois selects nativos lado a lado, sincronizados com um
   hidden input por js/ui/mes-ano-picker.js. Mantém a API "YYYY-MM" enquanto
   permite saltar de ano direto pelo dropdown. */
.mes-ano-picker {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.mes-ano-picker .mes-ano-picker__mes {
    flex: 1 1 auto;
    min-width: 0;
}

.mes-ano-picker .mes-ano-picker__ano {
    flex: 0 0 100px;
}

/* Painel */
.panel {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--secondary-light);
}

.panel-header h2 {
    margin: 0;
    color: var(--text-dark);
    font-size: 1.3em;
    font-weight: 700;
}

.panel-subtitle {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 0.92em;
}

/* Tabela */
.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.96em;
}

.data-table thead th {
    background-color: var(--background-light);
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.78em;
    letter-spacing: 0.05em;
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--secondary-light);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: #fafbfc;
}

.data-table tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--secondary-light);
    vertical-align: middle;
}

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

.data-table .th-acao {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.data-table tbody td.cell-acao {
    text-align: right;
    white-space: nowrap;
}

.row-loading td,
.row-empty td {
    text-align: center !important;
    color: var(--text-muted);
    font-style: italic;
    padding: 32px 18px !important;
}

.cell-name {
    font-weight: 600;
    color: var(--text-dark);
}

.cell-muted {
    color: var(--text-muted);
}

.cell-currency {
    font-variant-numeric: tabular-nums;
    color: var(--text-dark);
    font-weight: 600;
}

/* Botões de ação compactos (linhas da tabela) */
.btn-icon-action {
    background: transparent;
    border: 1px solid var(--secondary-light);
    color: var(--primary-blue);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
    font-family: inherit;
    margin-left: 6px;
}

.btn-icon-action:first-child { margin-left: 0; }

.btn-icon-action:hover {
    background-color: var(--primary-blue);
    color: #fff;
    border-color: var(--primary-blue);
    transform: translateY(-1px);
}

.btn-icon-action.btn-icon-danger {
    color: var(--error-red);
}

.btn-icon-action.btn-icon-danger:hover {
    background-color: var(--error-red);
    color: #fff;
    border-color: var(--error-red);
}

.btn-icon-action.btn-icon-accent {
    color: #2C8C87;
}

.btn-icon-action.btn-icon-accent:hover {
    background-color: #2C8C87;
    border-color: #2C8C87;
}

/* Modal */
.modal[hidden] { display: none; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}

.modal-dialog {
    position: relative;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
    width: 100%;
    max-width: 540px;
    max-height: calc(100vh - 48px);
    overflow: hidden;
    z-index: 1;
    animation: modalIn 0.2s ease;
    display: flex;
    flex-direction: column;
}

.modal-dialog form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
}

.modal-dialog--small { max-width: 440px; }
.modal-dialog--wide { max-width: 720px; }

@keyframes modalIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--secondary-light);
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    color: var(--text-dark);
    font-size: 1.2em;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.7em;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    font-family: inherit;
}

.modal-close:hover { color: var(--text-dark); }

.modal-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-body > p { margin: 0 0 8px; }
.modal-body > p:last-child { margin-bottom: 0; }
.modal-body .text-muted {
    color: var(--text-muted);
    font-size: 0.9em;
}

/* Form rows */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-row:last-child { margin-bottom: 0; }
.form-row[hidden] { display: none; }

.form-row label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95em;
}

.required { color: var(--error-red); }

.form-optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.85em;
    margin-left: 6px;
}

.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="date"],
.form-row input[type="search"],
.form-row input[type="password"],
.form-row select {
    padding: 11px 14px;
    border: 1px solid var(--secondary-light);
    border-radius: 8px;
    font-size: 0.97em;
    font-family: inherit;
    color: var(--text-dark);
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-row input:focus,
.form-row select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(106, 142, 174, 0.18);
}

.form-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85em;
}

/* Campo de senha com botão "mostrar/ocultar". Primitivo compartilhado pelo
   cadastro de usuário e pela troca de senha. A aparência do input vem do bloco
   de inputs acima (já cobre `type="password"`); aqui só ajustamos o layout
   flex ao lado do botão. O toggle é ligado por JS e reflete o estado em
   `aria-pressed`. */
.senha-wrapper {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.senha-wrapper input {
    flex: 1;
    min-width: 0;
}

.senha-toggle {
    background-color: #fff;
    border: 1px solid var(--secondary-light);
    color: var(--primary-blue);
    border-radius: 8px;
    padding: 0 16px;
    font-size: 0.9em;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.senha-toggle:hover {
    background-color: var(--background-light);
    border-color: var(--primary-blue);
}

.senha-toggle[aria-pressed="true"] {
    background-color: var(--primary-blue);
    color: #fff;
    border-color: var(--primary-blue);
}

/* Form com prefixo (R$) ou sufixo (%) */
.input-affix {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--secondary-light);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-affix:focus-within {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(106, 142, 174, 0.18);
}

.input-affix__prefix,
.input-affix__suffix {
    background-color: var(--background-light);
    color: var(--text-muted);
    padding: 0 14px;
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 0.97em;
}

.input-affix__prefix { border-right: 1px solid var(--secondary-light); }
.input-affix__suffix { border-left: 1px solid var(--secondary-light); }

.input-affix input {
    flex: 1;
    border: none !important;
    border-radius: 0 !important;
    background: transparent;
    padding: 11px 12px;
    font-size: 0.97em;
    font-family: inherit;
    color: var(--text-dark);
    min-width: 0;
}

.input-affix input:focus {
    outline: none;
    box-shadow: none !important;
}

/* Form sections (para agrupar campos: Calculadora) */
.form-section {
    margin-bottom: 22px;
}

.form-section:last-child { margin-bottom: 0; }

.form-section-title {
    font-size: 0.78em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--secondary-light);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}

/* Erro no formulário */
.form-error {
    margin-top: 14px;
    padding: 10px 14px;
    background-color: #ffe6e6;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: var(--error-red);
    font-size: 0.92em;
    font-weight: 600;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid var(--secondary-light);
    flex-shrink: 0;
    background-color: #fff;
}

/* Responsividade */
@media (max-width: 720px) {
    main { padding: 0 16px 40px; }
    .page-header { align-items: flex-start; }
    .page-header h1 { font-size: 1.7em; }
    .filter-bar { padding: 16px 18px; }
    .filter-field { min-width: 0; width: 100%; }
    .panel-header { padding: 16px 18px; }
    .data-table thead th,
    .data-table tbody td { padding: 11px 14px; }
    .form-grid { grid-template-columns: 1fr; }
    .btn-icon-action { width: 34px; height: 34px; }
}
