/* ===================================================================
 * VigiAPP Main Stylesheet (v1.2)
 *
 * Description: Folha de estilo principal, consolidada e corrigida.
 * =================================================================== */

/* ===================================================================
 * TABLE OF CONTENTS
 * -------------------------------------------------------------------
 * 1.  Variables & Root
 * 2.  Font Imports (@font-face)
 * 3.  Global Styles & Resets
 * 4.  Layout (Wrapper, Main Content, Footer)
 * 5.  Navbar
 * 6.  Cards
 * 7.  Forms (Inputs, Labels, Buttons)
 * 8.  Tables & DataTables
 * 9.  Modals
 * 10. Alerts & Flash Messages
 * 11. Component-Specific Styles (Badges, Status, etc.)
 * 12. Animations (QR Code Scanner)
 * 13. Mobile & Responsiveness
 * 14. Action Banner
 * 15. Força Sempre Visível - Action Banner
 * 16. Loading Overlay
 * =================================================================== */

/* ===================================================================
 * 1. Variables & Root
 * =================================================================== */
:root {
    --primary-green: #2f9e41;
    --primary-red: #cd191e;
    --primary-black: #000000;
    --primary-white: #ffffff;
    --roboto-font: 'Roboto', sans-serif;
    --gray-medium: #cccccc;
}

/* ===================================================================
 * 2. Font Imports (@font-face)
 * -------------------------------------------------------------------
 * Local Roboto fonts to avoid depending on Google Fonts CDN and
 * improve performance.
 * =================================================================== */
@font-face {
    font-family: 'Roboto';
    src: url('../fonts/roboto/Roboto-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'Roboto';
    src: url('../fonts/roboto/Roboto-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}
@font-face {
    font-family: 'Roboto';
    src: url('../fonts/roboto/Roboto-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
}
@font-face {
    font-family: 'Roboto';
    src: url('../fonts/roboto/Roboto-BoldItalic.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
}

/* ===================================================================
 * 3. Global Styles & Resets
 * -------------------------------------------------------------------
 * Remove all animations and transitions by default for a more
 * stable and faster experience. Specific, controlled animations
 * can be added back in section 12.
 * =================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    /* Reset animations and transitions, but allow box-shadow */
    animation: none !important;
    transition: none !important;
    transform: none !important;
}

html,
body {
    font-family: var(--roboto-font);
    background-color: #f4f7f6; /* Um cinza muito claro para o fundo */
    color: var(--primary-black);
    height: 100%;
    margin: 0;
    overflow: hidden;
}

/* Ensure Font Awesome icons do not inherit the global font */
.fa, .fas, .far, .fab {
    font-family: "Font Awesome 6 Free";
}

h1, h2, h3, h4, h5, h6,
p, label, span, div {
    font-family: var(--roboto-font);
}

a {
    color: var(--primary-green);
}

a:hover {
    color: var(--primary-green-darker);
}

/* ===================================================================
 * 4. Layout (Wrapper, Main Content, Footer)
 * =================================================================== */
.app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.app-main-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
}

.footer {
    padding: 1rem 0;
    text-align: center;
    background-color: var(--primary-green);
    color: var(--primary-white);
    flex-shrink: 0;
}

/* ===================================================================
 * 5. Navbar
 * =================================================================== */
.navbar {
    background-color: var(--primary-green) !important;
    flex-shrink: 0;
}

/* Compatibilidade com navbar-dark se usado */
.navbar.navbar-dark {
    background-color: var(--primary-green) !important;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
    color: var(--primary-white) !important;
}

/* Garante texto branco em todos os elementos do navbar */
.navbar .navbar-nav .nav-link,
.navbar .navbar-brand,
.navbar .navbar-text,
.navbar-dark .navbar-nav .nav-link,
.navbar-dark .navbar-brand {
    color: var(--primary-white) !important;
}

/* Hover nos links */
.navbar .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:hover {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Toggler (menu mobile) */
.navbar .navbar-toggler,
.navbar-dark .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.navbar .navbar-toggler-icon,
.navbar-dark .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* Dropdown no navbar */
.navbar .dropdown-menu {
    background-color: var(--primary-green);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.navbar .dropdown-item {
    color: var(--primary-white) !important;
}

.navbar .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-white) !important;
}

/* ===================================================================
 * 6. Cards
 * =================================================================== */
.card {
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    border: 1px solid #e0e0e0;
}

.card-header {
    background-color: var(--primary-green);
    color: var(--primary-white);
    font-weight: bold;
    border-bottom: none;
}

.card-body {
    background-color: var(--primary-white);
    color: var(--primary-black);
}

/* ===================================================================
 * 7. Forms (Inputs, Labels, Buttons)
 * =================================================================== */
.form-label {
    font-weight: 500;
}

.form-control,
.form-select {
    color: var(--primary-black);
    background-color: var(--primary-white);
    border: 1px solid var(--gray-medium);
}

.form-control::placeholder {
    color: var(--gray-dark);
    opacity: 1;
}

.form-control:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 0.25rem rgba(47, 158, 65, 0.25);
}

.btn {
    font-weight: 500;
    border-radius: 0.25rem;
    cursor: pointer;
}

.btn-success, .btn-primary {
    background-color: var(--primary-green);
    border-color: var(--primary-green);
}

.btn-success:hover, .btn-primary:hover {
    background-color: #248735;
    border-color: #248735;
}

.btn-danger {
    background-color: var(--primary-red);
    border-color: var(--primary-red);
}

.btn-danger:hover {
    background-color: #b1161a;
    border-color: #b1161a;
}

.btn-warning {
    background-color: var(--primary-green);
    border-color: var(--primary-green);
    color: var(--primary-white);
}

.btn-warning:hover {
    background-color: var(--primary-green-darker);
    border-color: var(--primary-green-darker);
    color: var(--primary-white);
}

.btn-back-home {
    background-color: var(--primary-green);
    color: var(--primary-white);
}

/* ===================================================================
 * 8. Tables & DataTables
 * =================================================================== */
.table {
    width: 100%;
}

.table thead th {
    background-color: var(--primary-green);
    color: var(--primary-white);
}

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

.pagination .page-item.active .page-link {
    background-color: var(--primary-green);
    border-color: var(--primary-green);
    color: var(--primary-white);
}

.pagination .page-link {
    color: var(--primary-green);
}

/* ===================================================================
 * 9. Modals
 * =================================================================== */
.modal-content {
    border-radius: 8px;
    border: 1px solid var(--primary-green);
}

.modal-header {
    background-color: var(--primary-green);
    color: var(--primary-white);
    border-bottom: none;
}

.modal-body {
    min-height: 120px;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
}

/* ===================================================================
 * 10. Alerts & Flash Messages
 * =================================================================== */
.alert {
    border-radius: 8px;
    border: none;
    opacity: 1 !important; /* Ensure flash messages are always visible */
}

/* ===================================================================
 * 11. Component-Specific Styles
 * =================================================================== */
.dashboard-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.dashboard-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.icon-pessoas { color: #8fd19e !important; }
.icon-empresas { color: #5bc0de !important; }
.icon-ingressos { color: #a66dd4 !important; }
.icon-entregas { color: #c79e63 !important; }
.icon-correspondencias { color: #6c757d !important; }
.icon-ocorrencias { color: #dc3545 !important; }


/* Adicione ao seu arquivo CSS */
.btn-visualizar {
    background-color: #2563eb;
    color: #ffffff;
    padding: 0.375rem 0.75rem;
    border: none;
    border-radius: 0.25rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }
  
  .btn-visualizar:hover {
    background-color: #1d4ed8; /* tom mais escuro */
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

/* Severity colors */
.severity-baixa { background-color: #d8f0dd; color: var(--primary-green); }
.severity-media { background-color: #fff3cd; color: #664d03; }
.severity-alta { background-color: #f8d7d8; color: var(--primary-red); }
.severity-critica { background-color: var(--primary-red); color: white; font-weight: bold; }

/* Status colors */
.status-pendente { background-color: #fff3cd; color: var(--primary-black); }
.status-enviado, .status-entregue { background-color: #d8f0dd; color: var(--primary-green); }

.severity-baixa, .severity-media, .severity-alta, .severity-critica,
.status-pendente, .status-enviado, .status-entregue {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

/* ===================================================================
 * 12. Animations (QR Code Scanner)
 * =================================================================== */
.scan-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.scan-animation {
    width: 250px;
    height: 250px;
    border: 2px solid var(--primary-green);
    border-radius: 15px;
    position: relative;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(47, 158, 65, 0.5);
}

.scan-line {
    position: absolute;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, transparent, var(--primary-green), transparent);
    top: 0;
    box-shadow: 0 0 10px var(--primary-green);
    animation: scan 2s linear infinite !important;
}

@keyframes scan {
    0% { transform: translateY(0); }
    50% { transform: translateY(calc(250px - 4px)); }
    100% { transform: translateY(0); }
}

.scan-text {
    color: var(--primary-white);
    font-size: 1.2rem;
    margin-top: 20px;
    font-weight: bold;
    text-align: center;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* ===================================================================
 * 13. Mobile & Responsiveness
 * =================================================================== */

/* General mobile improvements (<= 992px) */
@media (max-width: 992px) {
    .btn, button, .nav-link, a.btn {
        min-height: 44px;
    }

    .form-control, .form-select {
        min-height: 44px;
    }

    .dashboard-icon {
        font-size: 3rem;
    }
}

/* Smartphones (<= 575px) */
@media (max-width: 575px) {
    .container, .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }

    .action-buttons .btn {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .scan-animation {
        width: 200px;
        height: 200px;
    }

    @keyframes scan {
        0% { transform: translateY(0); }
        50% { transform: translateY(calc(200px - 4px)); }
        100% { transform: translateY(0); }
    }
}

/* Table responsiveness */
@media (max-width: 767px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        text-align: left;
    }

    .dataTables_wrapper .dataTables_paginate ul.pagination {
        justify-content: flex-start;
    }
}

/* Mobile improvements for smaller screens */
@media (max-width: 768px) {
    .dashboard-icon {
        font-size: 2.5rem;
    }
}

/* ===================================================================
 * 14. Action Banner
 * =================================================================== */
.action-banner {
  background: linear-gradient(135deg, #2f9e41 0%, #3cb54f 100%);
  color: white;
  padding: 24px;
  border-radius: 8px;
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  box-shadow: 0 4px 6px rgba(47, 158, 65, 0.2);
  position: relative;
  z-index: 10;
}
.banner-content {
  display: flex;
  align-items: center;
  gap: 16px;
}
.banner-icon {
  font-size: 40px;
  opacity: 0.9;
}
.banner-text {
  flex-direction: column;
  justify-content: center;
}

.banner-text h3,
.banner-text p {
  display: block !important; /* Garante empilhamento vertical mesmo com herança flex */
}

/* Adiciona margem inferior para melhor espaçamento entre título e subtítulo */
.banner-text h3 {
  margin-bottom: 8px;
  margin-top: 0;
}

/* Corrige cor do texto no hover para evitar que fique branco e desapareça */
.btn-criar:hover {
  color: #2f9e41 !important; /* Mantém o verde original */
}

.banner-text h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}
.banner-text p {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 0;
  margin-top: 0;
  line-height: 1.4;
}
.btn-criar {
  background-color: white;
  color: #2f9e41;
  padding: 12px 32px;
  border: none;
  border-radius: 50px;
  font-weight: bold;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease !important; /* Permitir transição apenas para hover */
}
.btn-criar:hover {
  transform: scale(1.05) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
  .action-banner {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  .banner-content {
    flex-direction: column;
  }
  .btn-criar {
    width: 100%;
    justify-content: center;
  }
}

/* ===================================================================
 * 15. Força Sempre Visível - Action Banner
 * =================================================================== */
 
/* Garantir que o banner de ação esteja sempre visível */
.action-banner {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  overflow: visible !important;
  max-height: none !important;
  min-height: auto !important;
}

/* Evitar que animações ou transições escoodam o banner */
.action-banner * {
  display: inherit !important;
  visibility: inherit !important;
  opacity: inherit !important;
}

/* Garantir que o banner seja sempre renderizado */
.action-banner,
.action-banner .banner-content,
.action-banner .btn-criar {
  pointer-events: auto !important;
}

/* Fixar banner no topo da área de conteúdo */
.app-main-content .action-banner {
  position: sticky !important;
  top: 0;
  z-index: 50; /* acima de outros conteúdos mas abaixo da navbar */
  margin-top: 0;
}

/* ===================================================================
 * 16. Loading Overlay
 * =================================================================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1055; /* acima da maioria dos elementos e da navbar */
  color: #ffffff;
  font-size: 1.25rem;
  flex-direction: column;
  gap: 1rem;
}

.loading-overlay.hidden {
  display: none !important;
}

.loading-overlay .spinner-border {
  width: 3rem;
  height: 3rem;
} 