@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/* Paleta UP380 */
:root {
  --up380-azul: #1B365D;
  --up380-azul-claro: #005bb5;
  --up380-cinza-claro: #F5F6FA;
  --up380-branco: #FFFFFF;
  --up380-preto: #222B45;
  --up380-verde: #008c6a;
  --up380-vermelho: #C82333;
}

/* ============================================
   REGRAS GLOBAIS DE ALINHAMENTO
   ============================================ */

* {
  box-sizing: border-box;
}

body, .card, .table, .form-control, .btn, .navbar, .breadcrumb {
  color: var(--up380-preto) !important;
  background-color: var(--up380-branco) !important;
  font-family: 'Inter', Arial, sans-serif;
}

/* Alinhamento vertical global para flex containers */
.d-flex {
  align-items: center;
}

/* Altura consistente para elementos de formulário */
.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  min-height: 38px !important;
  display: flex;
  align-items: center;
}

/* ============================================
   NAVBAR - ALINHAMENTO PERFEITO
   ============================================ */

.navbar {
  background: var(--up380-azul) !important;
  min-height: 60px;
  display: flex;
  align-items: center;
}

.navbar-brand {
  font-weight: bold;
  font-size: 1.7rem;
  letter-spacing: 2px;
  color: var(--up380-verde) !important;
  display: flex;
  align-items: center;
  height: 40px;
  line-height: 1;
}

.navbar-brand img {
  height: 40px;
  width: auto;
  vertical-align: middle;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-nav .nav-item {
  display: flex;
  align-items: center;
  margin: 0;
}

.navbar-nav .nav-link {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 15px;
  line-height: 1;
  color: #e0e0e0 !important;
}

.navbar-nav .nav-link i {
  font-size: 1rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.navbar-nav .nav-link.active,
.navbar-nav .nav-link:hover {
  color: var(--up380-verde) !important;
}

.navbar-text {
  display: flex;
  align-items: center;
  height: 40px;
  line-height: 1;
  margin: 0 0.5rem;
}

.navbar .dropdown-menu {
  margin-top: 0.5rem;
}

.navbar .dropdown-toggle {
  display: flex;
  align-items: center;
  height: 40px;
}

/* ============================================
   CARDS - ALTURAS CONSISTENTES
   ============================================ */

.card {
  border-radius: 1rem;
  box-shadow: 0 2px 8px rgba(27,54,93,0.07);
  border: none;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.card-header {
  background: var(--up380-azul-claro);
  color: var(--up380-branco);
  border-radius: 1rem 1rem 0 0;
  display: flex;
  align-items: center;
  min-height: 50px;
  padding: 1rem 1.5rem;
}

.card-footer {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
}

.btn-primary, .btn-primary:focus {
  background: var(--up380-azul-claro) !important;
  color: #fff !important;
  border: none;
}
.btn-primary:hover {
  background: var(--up380-azul) !important;
}

.btn-secondary, .btn-secondary:focus {
  background: #555 !important;
  color: #fff !important;
}

.btn-success {
  background: var(--up380-verde);
  border: none;
}
.btn-success:hover {
  background: #009e6d;
}

.btn-danger {
  background: var(--up380-vermelho);
  border: none;
}
.btn-danger:hover {
  background: #d32f2f;
}

.btn-info {
  background: var(--up380-azul-claro);
  color: var(--up380-branco);
  border: none;
}
.btn-info:hover {
  background: var(--up380-azul);
}

/* ============================================
   TABELAS - ALINHAMENTO VERTICAL
   ============================================ */

.table {
  margin-bottom: 0;
}

.table thead {
  background: var(--up380-azul-claro);
  color: var(--up380-branco);
}

.table thead th {
  vertical-align: middle;
  padding: 12px 15px;
  font-weight: 600;
  line-height: 1.5;
  border: none;
}

.table tbody td {
  vertical-align: middle;
  padding: 12px 15px;
  line-height: 1.5;
  border-top: 1px solid #dee2e6;
}

.table-striped > tbody > tr:nth-of-type(odd) {
  background-color: #eaf1fb;
}

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

/* ============================================
   FORMULÁRIOS - LABELS E INPUTS ALINHADOS
   ============================================ */

.form-label {
  margin-bottom: 0.5rem;
  font-weight: 500;
  line-height: 1.5;
  display: flex;
  align-items: center;
  color: var(--up380-preto);
}

.form-group {
  margin-bottom: 1rem;
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group-text {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  line-height: 1;
}

.badge.bg-warning {
  background: #ffe066 !important;
  color: #222B45 !important;
}
.badge.bg-info {
  background: var(--up380-azul-claro) !important;
  color: #fff !important;
}
.badge.bg-success {
  background: var(--up380-verde) !important;
  color: #fff !important;
}
.badge.bg-danger {
  background: var(--up380-vermelho) !important;
  color: #fff !important;
}

.alert-success {
  background: #e6fff6;
  color: var(--up380-verde);
  border: 1px solid var(--up380-verde);
}
.alert-danger {
  background: #fff0f3;
  color: var(--up380-vermelho);
  border: 1px solid var(--up380-vermelho);
}

/* Cards de resumo - tamanho original */
.card-resumo {
  background: var(--up380-branco);
  border-radius: 1.2rem;
  box-shadow: 0 4px 16px rgba(27,54,93,0.10);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
  transition: box-shadow 0.2s;
}
.card-resumo:hover {
  box-shadow: 0 8px 24px rgba(27,54,93,0.18);
}
.card-resumo .icon {
  font-size: 2.5rem;
  color: var(--up380-azul-claro);
}
.card-resumo .value {
  font-size: 2.1rem;
  font-weight: 700;
}
.card-resumo .label {
  color: #7a869a;
  font-size: 1rem;
}

.card-resumo .label b {
  color: var(--up380-vermelho);
  background: #fff0f3;
  padding: 0.2em 0.7em;
  border-radius: 0.6em;
  font-size: 1.2em;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(255,61,113,0.10);
  border: 2px solid var(--up380-vermelho);
}

.table-hover tbody tr:hover {
  background: #e0f0ff;
  transition: background 0.2s;
}

/* ============================================
   BADGES - ALINHAMENTO COM TEXTO
   ============================================ */

.badge {
  font-size: 1rem;
  padding: 0.5em 1em;
  border-radius: 0.7em;
  font-weight: 600;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  line-height: 1;
  vertical-align: middle;
}

.badge i {
  font-size: 0.875em;
  line-height: 1;
}

.toast {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  min-width: 220px;
  z-index: 9999;
  background: var(--up380-branco);
  color: var(--up380-preto);
  border: 1px solid #dbe2ef;
  border-radius: 0.7rem;
  box-shadow: 0 2px 8px rgba(27,54,93,0.10);
  padding: 1rem 1.5rem;
  opacity: 0.98;
  display: none;
}
.toast.show {
  display: block;
  animation: fadeIn 0.5s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 0.98; transform: translateY(0); }
}

input, select, textarea {
  border-radius: 0.7rem !important;
  border: 1.5px solid #dbe2ef !important;
  font-size: 1.1rem;
  padding: 0.7rem 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--up380-azul-claro) !important;
  box-shadow: 0 0 0 2px #b3d8fd;
}

/* ============================================
   BOTÕES - TAMANHOS CONSISTENTES
   ============================================ */

.btn {
  border-radius: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: box-shadow 0.2s, background 0.2s;
  box-shadow: 0 2px 8px rgba(27,54,93,0.07);
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  gap: 8px;
  line-height: 1;
}

.btn i {
  font-size: 1rem;
  line-height: 1;
  vertical-align: middle;
}

.btn-sm {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 0.875rem;
}

.btn-lg {
  min-height: 48px;
  padding: 12px 24px;
  font-size: 1.125rem;
}

.btn:active {
  box-shadow: 0 1px 2px rgba(27,54,93,0.10);
}

/* Responsividade para tabelas e painéis */
.table-responsive {
  overflow-x: auto;
}

@media (max-width: 768px) {
  .table thead {
    display: none;
  }
  .table tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    background: #fff;
  }
  .table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    font-size: 1rem;
  }
  .table tbody td:before {
    content: attr(data-label);
    font-weight: bold;
    color: #0076D7;
    flex-basis: 50%;
    text-align: left;
  }
  .table tbody td:last-child {
    border-bottom: none;
  }
  .btn, .btn-sm {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  .card, .card-body {
    padding: 0.5rem;
  }
  .filtro-sticky, .row.g-3.mb-3, .row.mb-4 {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* Melhorar espaçamento de botões em mobile */
@media (max-width: 480px) {
  .btn, .btn-sm {
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
  }
}


::-webkit-scrollbar {
  width: 8px;
  background: #eaf1fb;
}
::-webkit-scrollbar-thumb {
  background: var(--up380-azul-claro);
  border-radius: 4px;
}

.destaque-aberto {
  color: var(--up380-vermelho);
  background: #fff0f3;
  padding: 0.1em 0.5em;
  border-radius: 0.5em;
  font-weight: 700;
  border: 1.5px solid var(--up380-vermelho);
  font-size: 1.1em;
}

.badge-alerta {
  background: var(--up380-vermelho);
  color: #fff;
  font-weight: bold;
  padding: 0.2em 0.7em;
  border-radius: 0.7em;
  font-size: 1.1em;
  animation: pulse 1.2s infinite;
  box-shadow: 0 0 0 2px #ffb3c6;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 2px #ffb3c6; }
  50% { box-shadow: 0 0 0 8px #ffb3c6; }
  100% { box-shadow: 0 0 0 2px #ffb3c6; }
}

/* Modern Navbar */
.navbar-modern {
    background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 35%, rgba(0,212,255,1) 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.navbar-modern .navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: #fff;
    transition: color 0.3s;
}

.navbar-modern .nav-link {
    color: #e0e0e0;
    font-weight: 500;
    margin: 0 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

.navbar-modern .nav-link:hover, .navbar-modern .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.navbar-modern .navbar-text {
    color: #b0b0b0;
}

.navbar-modern .btn-logout {
    border-color: #fff;
    color: #fff;
    transition: background-color 0.3s, color 0.3s;
}

.navbar-modern .btn-logout:hover {
    background-color: #fff;
    color: #0d6efd;
}

/* Interactive Logo Effect */
#navbar-logo {
    height: 50px;
    width: auto;
    transition: transform 0.3s ease-in-out, filter 0.3s ease;
}

#navbar-logo.logo-interactive {
    transform: scale(1.15) rotate(10deg);
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.8));
}

/* ============================================
   SISTEMA DE SEGMENTOS - CARDS MODERNOS
   ============================================ */

/* Cards de Segmentos */
.segmento-card {
    background: linear-gradient(135deg, #1976d2 0%, #2196f3 100%);
    border: none;
    border-radius: 1.2rem;
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
}

.segmento-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 0%, rgba(255,255,255,0.15), transparent 70%);
    pointer-events: none;
}

.segmento-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3) !important;
}

/* Cards de Empresas */
.empresa-card {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    border-radius: 1.2rem;
    transition: all 0.3s ease;
}

.empresa-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25) !important;
}

/* Badges translúcidos */
.badge-glass {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 0.8rem;
    font-weight: 600;
}

/* Breadcrumbs estilizados */
.breadcrumb {
    background: rgba(27, 54, 93, 0.05);
    padding: 0.75rem 1.5rem;
    border-radius: 0.8rem;
    border: 1px solid rgba(27, 54, 93, 0.1);
}

.breadcrumb-item a {
    color: #1976d2;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.breadcrumb-item a:hover {
    color: #2196f3;
}

.breadcrumb-item.active {
    font-weight: 700;
    color: #1B365D;
}

/* Animações */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.6s ease-out;
}

/* Ícones flutuantes */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.icon-float {
    animation: float 3s ease-in-out infinite;
}

/* Responsividade para segmentos */
@media (max-width: 768px) {
    .segmento-card,
    .empresa-card {
        margin-bottom: 1rem;
    }
    
    .breadcrumb {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 480px) {
    .segmento-card h4 {
        font-size: 1.2rem;
    }
    
    .empresa-card h6 {
        font-size: 0.95rem;
    }
}

/* Botões com efeito glass */
.btn-glass {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    transition: all 0.3s ease;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Efeito de pulso nas badges de alerta */
.badge-pulse {
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0% {
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0);
    }
}

/* Hover effects nos cards */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
}

/* ============================================
   HOVER SIDEBAR TRIGGER (DESKTOP)
   ============================================ */
@media (min-width: 769px) {
    .sidebar-hover-trigger {
        position: fixed;
        top: 0;
        left: 0;
        width: 20px; /* Largura da �rea sens�vel */
        height: 100vh;
        z-index: 1002;
        cursor: pointer;
        background: transparent;
    }

    /* Quando o menu est� fechado, ele fica escondido */
    .sidebar.closed {
        transform: translateX(-100%);
    }

    /* Ajuste para quando est� aberto via hover */
    .sidebar:not(.closed) {
        box-shadow: 4px 0 24px rgba(27, 54, 93, 0.25);
    }
}

/* ============================================
   MINI SIDEBAR (DESKTOP) - REPLACES HOVER TRIGGER
   ============================================ */
@media (min-width: 769px) {
    /* O trigger antigo n�o � mais necess�rio, escondemos ele se ainda existir */
    .sidebar-hover-trigger {
        display: none !important;
    }

    /* MINI SIDEBAR: Quando fechado, mostra icons */
    .sidebar.closed {
        transform: none;
        width: 70px;
        overflow: hidden;
    }

    /* Esconde textos quando fechado */
    .sidebar.closed .sidebar-logo,
    .sidebar.closed .sidebar-menu-link span,
    .sidebar.closed .sidebar-submenu-link span,
    .sidebar.closed .sidebar-header .bi-list,
    .sidebar.closed .font-adjust-container,
    .sidebar.closed .user-info-content,
    .sidebar.closed .bi-chevron-down {
        display: none !important;
        opacity: 0;
    }

    /* Centraliza �cones */
    .sidebar.closed .sidebar-menu-link,
    .sidebar.closed .sidebar-submenu-link {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    .sidebar.closed .sidebar-menu-link i,
    .sidebar.closed .sidebar-submenu-link i {
        margin: 0;
        font-size: 1.5rem;
    }

    /* Ajuste da margem do conte�do principal quando sidebar est� mini */
    .main-content.sidebar-closed {
        margin-left: 70px !important;
    }

    /* Sidebar aberto sempre sobrep�e se expandir, ou empurra?
       O pedido foi 'aparecendo apenas os emojis'.
       Geralmente expande 'por cima' (z-index) ou empurra.
       Como a l�gica anterior era 'overlay' no hover, vamos manter 'por cima' para n�o quebrar layout fluido */
    .sidebar.open {
        width: 280px;
        z-index: 1001;
        box-shadow: 4px 0 24px rgba(27, 54, 93, 0.25);
    }
}
