/* static/css/base.css */

:root {
    --primary-color: #779f0afb; /* Verde Bootstrap */
    --primary-hover: #5f7e07fb; /* Verde mais escuro para hover */
 
    --error-color:  #c82333; /* Vermelho para erros */ 
    --error-color-hover:#dc3545; /* Vermelho para erros hover*/
 
    --cancel-color: #6c757d; 
    --cancel-color-hover: #5a6268; 

    --text-color: #333;
    --background-color: #f8f9fa;    

    --success-color: #28a745;
    --spinner-color: #779f0afb; /* Cor do spinner, alinhada com o tema */
    --spinner-background: #f3f3f3; /* Fundo do spinner */

    --header-height: 60px;

}

body {
    font-family: Arial, sans-serif;
    background-color: #f8f9fa;
    color: var(--text-color);
    margin: 0;
    padding: 0;
    font-size: 18px;
    padding-top: var(--header-height);

}



/* ===============================
   Tipografia Base — E2Tec
   =============================== */

h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }

p {
    font-size: 16px;
    line-height: 1.5;
}

@media (min-width: 1200px) {
    body {
        font-size: 19px;
    }
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--primary-color);
    color: white;

    display: flex;
    align-items: center;
    justify-content: center;

    z-index: 1200;

    border-bottom: 1px solid rgba(255, 255, 255, 0.25); /* 👈 linha divisória */
}


.current-lang {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);

    font-size: 14px;
    opacity: 0.9;
    white-space: nowrap;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}



header h1 {
    margin: 0;
    font-size: 24px;
}

.button-cancel {
    background-color: var(--cancel-color, #6c757d);
    color: white;
}

.button-cancel:hover {
    background-color: var(--cancel-color-hover, #5a6268);
    color: white;
}

/* Garantir botões de modal com mesmo tamanho */
.modal-buttons button {
    min-width: 120px;
    height: 40px;
    padding: 0 20px;
    font-size: 14px;
}

.modal-confirm-delete {
    background-color: var(--error-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.modal-confirm-delete:hover {
    background-color: var(--error-color-hover);
}


.action-buttons a,
.action-buttons button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;

    width: 250px;
    height: calc(100vh - var(--header-height));

    background-color: var(--primary-color);
    border-right: 1px solid #ddd;

    z-index: 1000;
}



.sidebar::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background-color: var(--primary-color);
}


.sidebar.active {
    left: 0;
}

.sidebar ul {
    list-style: none;
    padding: 16px 20px 20px;
    margin: 0;
}


.sidebar ul li {
    margin: 10px 0;
}

.sidebar ul li a {
    display: block;
    padding: 10px;
    color: white;
    text-decoration: none;
}

.sidebar ul li a.active {
    background-color: var(--primary-hover);
    color: white;
    border-radius: 4px;
}

.sidebar ul li a:hover {
    background-color: var(--primary-hover);
    color: white;
}

.toggle-btn {
    position: fixed;
    top: 60px;
    left: 20px;
    font-size: 24px;
    cursor: pointer;
    z-index: 1100;
    color: var(--primary-color);
    background-color: white;
    padding: 5px 10px;
    border-radius: 4px;
    display: none !important;
}

.toggle-btn.active {
    color: white;
    background-color: var(--primary-color);
}


/* Estilo do spinner */
.spinner {
    border: 4px solid var(--spinner-background);
    border-top: 4px solid var(--spinner-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.spinner.hidden {
    display: none;
}

.submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}


.spinner-container {
    margin-top: 16px;
    display: flex;
    justify-content: center;
}

.hidden {
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (min-width: 769px) {
    .sidebar {
        left: 0;
        position: fixed;
    }

    /* Somente quando há menu */
    .content.shifted {
        margin-left: 250px;
    }

    /* Telas sem menu (login, reset, etc.) */
    .content:not(.shifted) {
        margin-left: 0;
    }

    .toggle-btn {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 200px;
        left: -200px;
    }
    .sidebar.active {
        left: 0;
    }

    .sidebar ul {
        padding-top: 120px;
    }

    .content {
        margin-left: 0;
    }
    .content.shifted {
        margin-left: 200px;
    }
    .toggle-btn {
        display: block !important;
        background-color: white;
    }
    .toggle-btn.active {
        background-color: var(--primary-color);
    }
    .server-datetime {
        display: block;
    }
}

@media (max-width: 480px) {
    .login-container,
    .reset-password,
    .reset-password-request {
        max-width: 100%;
        margin: 40px 16px;
        padding: 20px;
    }

    .form-group input {
        padding: 8px;
        font-size: 14px;
    }

    .login-container button,
    .reset-password button,
    .reset-password-request button {
        padding: 10px;
        font-size: 14px;
    }

}

@media (max-width: 360px) {
    .login-container,
    .reset-password,
    .reset-password-request {
        margin: 24px 10px;
        padding: 16px;
    }
}


/* Estilos comuns para modais */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1300;
}

.modal:not(.hidden) {
    display: flex !important;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 5px;

    width: 90%;
    max-width: 900px;

    /* 🔑 CONTENÇÃO VERTICAL */
    max-height: 85vh;

    /* 🔑 LAYOUT CORRETO */
    display: flex;
    flex-direction: column;

    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modal-body-scroll {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 8px;
}


/* Área interna rolável do modal (tabelas, listas grandes) */
/*.modal-content table {
    display: block;
    width: 100%;

    overflow-y: auto;
    max-height: 60vh;
}

.modal-content thead,
.modal-content tbody {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.modal-content tbody {
    display: block;
    overflow-y: auto;
}
*/

/* ===============================
   TABELAS DENTRO DE MODAL
   =============================== */

.modal-content table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* 🔑 garante alinhamento */
}

/* Cabeçalho */
.modal-content thead th {
    text-align: left;
    padding: 8px 10px;
    font-weight: 600;
    background-color: #f5f5f5;
}

/* Corpo */
.modal-content tbody td {
    padding: 8px 10px;
    vertical-align: top;
}

/* Wrapper de scroll SOMENTE no corpo */
.modal-content .table-scroll {
    max-height: 60vh;
    overflow-y: auto;
}


.modal-content h3 {
    margin-top: 0;
    font-size: 18px;
    color: var(--text-color, #333);
}

.modal-buttons {
    margin-top: 16px;
    padding-top: 12px;

    border-top: 1px solid #eee;
    justify-content: center; /* 🔑 CENTRALIZA */

    flex-shrink: 0; /* 🔑 NUNCA encolhe */
}


.modal-confirm {
    padding: 10px 20px;
    background-color: var(--primary-color, #779f0afb);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.modal-confirm:hover:not(.disabled) {
    background-color: var(--primary-hover, #5f7e07fb);
}

.modal-cancel {
    padding: 10px 20px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.modal-cancel:hover:not(.disabled) {
    background-color: #5a6268;
}

.modal-confirm.disabled,
.modal-cancel.disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.5;
}

.modal .loading {
    text-align: center;
    margin-top: 20px;
}

.modal .loading p {
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-color, #333);
}

.modal .modal-confirm-delete {
    background-color: var(--error-color, #dc3545) !important;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.modal .modal-confirm-delete:hover {
    background-color: var(--error-color-hover, #c82333) !important;
}

/* 🔥 FIX DEFINITIVO: botões de modal com mesmo tamanho */
.modal .modal-buttons {
    display: flex;
    gap: 12px;
}

.modal .modal-buttons button {
    width: 140px !important;   /* mata o width:100% global */
    min-width: 140px;
    max-width: 140px;

    height: 40px;
    padding: 0;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    margin: 0 !important;      /* mata margin-top global */
    box-sizing: border-box;
}

/* ===============================
   Reset seguro e completo para links que viram botão
   =============================== */

a.action-btn,
a.create-client-btn,
a.btn,
a.btn-primary,
a.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    text-decoration: none !important;
    color: inherit;

    border: none;
    outline: none;

    cursor: pointer;
}

/* Garante que hover NÃO volte sublinhado */
a.action-btn:hover,
a.create-client-btn:hover,
a.btn:hover {
    text-decoration: none !important;
}

/* ===============================
   Tooltip de ajuda (Help ?)
   =============================== */

.help-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 18px;
    height: 18px;
    margin-left: 6px;

    border-radius: 50%;
    background-color: var(--cancel-color);
    color: white;

    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

.help-tooltip-text {
    visibility: hidden;
    opacity: 0;

    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);

    min-width: 220px;
    max-width: 320px;

    background-color: #333;
    color: #fff;
    padding: 10px 12px;
    border-radius: 4px;

    font-size: 13px;
    line-height: 1.4;
    text-align: left;

    z-index: 1500;

    transition: opacity 0.2s ease;
}

/* Setinha */
.help-tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

/* Hover e focus */
.help-tooltip:hover .help-tooltip-text,
.help-tooltip:focus .help-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ===============================
   Botões desabilitados
   =============================== */

.action-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(30%);
}

.flash-success {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    text-align: center;
}

.flash-warning {
    background-color: #fff3cd;
    color: #856404;
    padding: 10px;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
}

.flash-error {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    text-align: center;
}

.best-practices {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 10px 14px;
  background-color: #fafafa;
}

.best-practices summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.best-practices summary::-webkit-details-marker {
  display: none;
}

.best-practices ul {
  margin-top: 10px;
  padding-left: 18px;
}

.best-practices li {
  margin-bottom: 6px;
}

.content.shifted {
    margin-top: 0;
}
