/* ============= ESTILOS GLOBAIS ============= */
:root {
  --primary: #1089ab;
  --primary-light: #f58120;
  --secondary: #9da138;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --info: #17a2b8;
  --light: #f8f9fa;
  --dark: #343a40;
  --body-bg: #f8f9fa;
  --header-height: 70px;
  --sidebar-width: 280px;
  --sidebar-width-collapsed: 80px;
  --transition-speed: 0.3s;
  --gradient-primary: linear-gradient(135deg, #1089ab, #f58120);
  --gradient-secondary: linear-gradient(135deg, #f58120, #9da138);
  --gradient-tertiary: linear-gradient(135deg, #9da138, #1089ab);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
  background-color: var(--body-bg);
  color: var(--dark);
  line-height: 1.6;
}

/* ============= ANIMAÇÕES ============= */
@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes slideInUp {
  0% {
    transform: translateY(50px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes floatBg {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(20px, 15px) scale(1.1);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

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

@keyframes gradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ============= LOADING ============= */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-primary);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  color: white;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

/* ============= LOGIN ============= */
.login-body {
  overflow: hidden;
  height: 100vh;
  background: var(--light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-primary);
  overflow: hidden;
}

.login-shape {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  animation: floatBg 15s ease-in-out infinite;
}

.login-shape:nth-child(1) {
  width: 500px;
  height: 500px;
  top: -100px;
  right: -100px;
  animation: floatBg 15s ease-in-out infinite;
}

.login-shape:nth-child(2) {
  width: 400px;
  height: 400px;
  bottom: -100px;
  left: -100px;
  animation: floatBg 20s ease-in-out infinite;
}

.login-form-container {
  position: relative;
  z-index: 10;
  width: 90%;
  max-width: 450px;
  animation: fadeIn 1s ease-out, slideInUp 1s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}

.login-logo {
  max-width: 220px;
  height: auto;
  margin-bottom: 20px;
  animation: fadeIn 1.2s ease-out;
  filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.1));
  transition: all 0.3s ease;
}

.login-title {
  color: white;
  font-weight: 700;
  font-size: 3rem;
  margin-bottom: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.login-subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

.login-card {
  border-radius: 15px;
  border: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.login-btn {
  height: 48px;
  border-radius: 24px;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: var(--gradient-primary);
  border: none;
  transition: all 0.3s ease;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 123, 255, 0.4);
}

.login-footer {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

/* ============= SIDEBAR ============= */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100%;
  width: var(--sidebar-width);
  background-color: white;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  transition: all var(--transition-speed) ease;
  z-index: 1000;
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 20px;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.sidebar::-webkit-scrollbar-track {
  background-color: transparent;
}

.sidebar.collapsed {
  width: var(--sidebar-width-collapsed);
}

.sidebar-logo {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  background: linear-gradient(to right, rgba(255,255,255,0.9), white);
  position: sticky;
  top: 0;
  z-index: 2;
}

.logo-img {
  height: 40px;
  width: auto;
  margin-right: 10px;
  transition: all var(--transition-speed) ease;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.1));
}

.logo-text {
  font-weight: 700;
  font-size: 1.4rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-left: 10px;
  transition: opacity var(--transition-speed) ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.collapsed .logo-text {
  opacity: 0;
  width: 0;
}

.sidebar.collapsed .logo-img {
  margin-right: 0;
  margin-left: 10px;
}

.sidebar-menu {
  padding: 15px 0;
  list-style: none;
}

.menu-item {
  position: relative;
  margin-bottom: 5px;
}

.menu-link {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: var(--dark);
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
  position: relative;
  overflow: hidden;
}

.menu-link:hover,
.menu-link.active {
  background-color: rgba(16, 137, 171, 0.08);
  border-left-color: var(--primary);
}

.menu-link.active {
  background-color: rgba(16, 137, 171, 0.12);
  font-weight: 500;
}

.menu-link:hover::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 5px;
  height: 100%;
  background: var(--gradient-primary);
  opacity: 0.5;
}

.menu-icon {
  font-size: 1.1rem;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  transition: transform 0.3s ease;
  margin-right: 10px;
}

.menu-link:hover .menu-icon,
.menu-link.active .menu-icon {
  transform: translateY(-2px);
}

.menu-text {
  transition: opacity var(--transition-speed) ease;
  font-size: 0.95rem;
  white-space: nowrap;
}

.sidebar.collapsed .menu-text {
  opacity: 0;
  width: 0;
}

.dropdown-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  background-color: rgba(248, 249, 250, 0.7);
  margin-left: 20px;
  margin-right: 10px;
  border-radius: 0 0 10px 10px;
}

.dropdown-container.active {
  max-height: 1000px;
  margin-bottom: 10px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

.submenu-item {
  padding: 10px 15px 10px 45px;
  display: block;
  color: var(--dark);
  text-decoration: none;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  position: relative;
  border-radius: 0 0 8px 8px;
}

.submenu-item::before {
  content: '';
  position: absolute;
  left: 30px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--primary);
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.submenu-item:hover::before,
.submenu-item.active::before {
  opacity: 1;
}

.submenu-item:hover,
.submenu-item.active {
  color: var(--primary);
  background-color: rgba(16, 137, 171, 0.05);
  padding-left: 48px;
}

.has-dropdown::after {
  content: "\f107";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.3s ease, opacity 0.3s ease;
  color: rgba(0, 0, 0, 0.4);
}

.has-dropdown.active::after {
  transform: translateY(-50%) rotate(180deg);
  color: var(--primary);
}

.sidebar.collapsed .has-dropdown::after {
  opacity: 0;
}

/* ============= MAIN CONTENT ============= */
.main-content {
  margin-left: var(--sidebar-width);
  transition: margin-left var(--transition-speed) ease;
  min-height: 100vh;
  padding-top: var(--header-height);
}

.main-content.expanded {
  margin-left: var(--sidebar-width-collapsed);
}

/* ============= HEADER ============= */
.header {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  height: var(--header-height);
  background-color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  z-index: 999;
  transition: left var(--transition-speed) ease;
}

.header.expanded {
  left: var(--sidebar-width-collapsed);
}

.toggle-sidebar {
  background: none;
  border: none;
  color: var(--dark);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: background-color 0.3s ease;
}

.toggle-sidebar:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.header-right {
  display: flex;
  align-items: center;
}

.header-icon {
  color: var(--dark);
  font-size: 1.2rem;
  margin-left: 20px;
  position: relative;
  cursor: pointer;
  transition: color 0.3s ease;
}

.header-icon:hover {
  color: var(--primary);
}

.notification-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--primary-light);
  color: white;
  border-radius: 50%;
  height: 18px;
  width: 18px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-menu {
  display: flex;
  align-items: center;
  margin-left: 30px;
  cursor: pointer;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 10px;
}

.user-name {
  font-weight: 500;
  font-size: 0.9rem;
}

/* ============= DASHBOARD ============= */
.dashboard-container {
  padding: 30px;
}

.section-title {
  font-weight: 600;
  margin-bottom: 1.5rem;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: "";
  display: block;
  width: 50px;
  height: 3px;
  background: var(--gradient-primary);
  margin-top: 8px;
  border-radius: 3px;
}

.card {
  border: none;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}

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

.metric-card {
  padding: 20px;
  height: 100% !important;
}

.metric-icon {
  position: absolute;
  top: -15px;
  right: 15px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  box-shadow: 0 4px 10px rgba(16, 137, 171, 0.3);
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  margin: 10px 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.metric-label {
  color: var(--secondary);
  font-size: 0.9rem;
}

.chart-container {
  padding: 20px;
  height: 100%;
}

.chart-title {
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--dark);
  font-size: 1.1rem;
}

.chart-card {
  height: 100%;
}

.chart-wrapper {
  position: relative;
  height: 300px;
  width: 100%;
}

/* ============= CHAT ============= */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.chat-footer {
  padding: 15px 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.message {
  display: flex;
  margin-bottom: 20px;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 15px;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-content {
  max-width: 70%;
}

.message-text {
  padding: 12px 15px;
  border-radius: 15px;
  position: relative;
  font-size: 0.95rem;
}

.message-time {
  font-size: 0.75rem;
  color: var(--secondary);
  margin-top: 5px;
}

.message.incoming .message-text {
  background-color: #f1f1f1;
  color: var(--dark);
  border-top-left-radius: 5px;
}

.message.outgoing {
  flex-direction: row-reverse;
}

.message.outgoing .message-avatar {
  margin-right: 0;
  margin-left: 15px;
}

.message.outgoing .message-content {
  align-items: flex-end;
}

.message.outgoing .message-text {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-top-right-radius: 5px;
}

.message.outgoing .message-time {
  text-align: right;
}

.chat-input {
  display: flex;
  position: relative;
}

.chat-input input {
  flex: 1;
  padding: 12px 60px 12px 20px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 24px;
  font-size: 0.95rem;
}

.chat-input button {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.chat-input button:hover {
  transform: translateY(-50%) scale(1.05);
}

/* ============= FORM STYLES ============= */
.form-container {
  background-color: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.form-title {
  font-weight: 600;
  margin-bottom: 1.5rem;
  position: relative;
  display: inline-block;
}

.form-title::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 40px;
  height: 3px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 3px;
}

.form-subtitle {
  color: var(--secondary);
  margin-bottom: 2rem;
}

.btn-primary {
  background: var(--gradient-primary);
  border: none;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 8px;
}

.btn-primary:hover {
  box-shadow: 0 5px 15px rgba(16, 137, 171, 0.4);
  transform: translateY(-2px);
}

.file-upload {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  height: 200px;
  border: 2px dashed rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  background-color: #f8f9fa;
  transition: all 0.3s ease;
  cursor: pointer;
}

.file-upload:hover {
  border-color: var(--primary);
  background-color: rgba(0, 123, 255, 0.05);
}

.file-upload-icon {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 10px;
}

.file-upload-text {
  font-size: 1rem;
  color: var(--dark);
}

/* ============= RESPONSIVE ============= */
@media (max-width: 992px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    z-index: 1050;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    transition: transform var(--transition-speed) ease;
  }

  .sidebar.show {
    transform: translateX(0);
    width: 280px;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .sidebar.collapsed .logo-text,
  .sidebar.collapsed .menu-text {
    opacity: 1;
    width: auto;
  }

  .main-content,
  .header {
    margin-left: 0;
    left: 0;
  }

  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
  }

  .sidebar-overlay.show {
    display: block;
    opacity: 1;
  }

  .sidebar.show .logo-text,
  .sidebar.show .menu-text {
    opacity: 1;
    width: auto;
  }

  .sidebar.show .has-dropdown::after {
    opacity: 1;
  }
  
  .toggle-sidebar {
    display: flex;
  }
}

@media (max-width: 768px) {
  .dashboard-container {
    padding: 20px 15px;
  }

  .metric-card {
    margin-bottom: 20px;
  }

  .chart-container {
    margin-bottom: 20px;
  }
  
  .header {
    padding: 0 15px;
  }
  
  .header-right {
    margin-left: auto;
  }
  
  .user-name {
    display: none;
  }
}

@media (max-width: 576px) {
  .sidebar {
    width: 100%;
    max-width: 300px;
  }

  .sidebar.show {
    width: 85%;
    max-width: 300px;
  }

  .login-form-container {
    width: 95%;
  }
  
  .menu-link {
    padding: 12px 15px;
  }
  
  .submenu-item {
    padding: 10px 10px 10px 40px;
  }
  
  .submenu-item:hover, 
  .submenu-item.active {
    padding-left: 43px;
  }
  
  .login-logo {
    max-width: 180px;
  }
  
  .login-form-container {
    padding: 10px 0;
  }
  
  .login-card {
    margin-top: 0;
  }
  
  .logo-text {
    font-size: 1.1rem;
  }
  
  .logo-img {
    height: 35px;
  }
  
  .header-icon {
    margin-left: 15px;
  }
  
  .notification-badge {
    height: 16px;
    width: 16px;
    font-size: 0.65rem;
  }
}

@media (max-width: 400px) {
  .sidebar.show {
    width: 100%;
    max-width: none;
  }
  
  .header-icon {
    margin-left: 10px;
  }
  
  .login-card {
    padding: 15px;
  }
  
  .card-body.p-4.p-md-5 {
    padding: 15px !important;
  }
}

@media (max-height: 700px) {
  .login-logo {
    max-width: 160px;
    margin-bottom: 15px;
  }
  
  .login-subtitle {
    margin-bottom: 15px;
    font-size: 1rem;
  }
  
  .login-form-container {
    padding: 0;
  }
  
  .mt-5.mb-5 {
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
  }
  
  .mb-4 {
    margin-bottom: 0.75rem !important;
  }
}

/* Estilos para notificações toast */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1060;
}

.toast {
  background-color: #fff;
  border-radius: 0.25rem;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
  max-width: 350px;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.toast.show {
  opacity: 1;
}

/* Efeitos de carregamento para gráficos e tabelas */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5;
  border-radius: 0.375rem;
}

.chart-wrapper {
  position: relative;
  min-height: 250px;
}

/* Estilos para filtros de data */
.custom-date-range.show {
  display: block !important;
}

/* Animações para atualização de dados */
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
  100% {
    opacity: 1;
  }
}

.pulse-animation {
  animation: pulse 1s ease-in-out;
}

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

.metric-card {
  transition: all 0.3s ease;
}

.metric-card.updated {
  animation: fadeUp 0.5s ease-out;
}

/* Estilos para botões de exportação */
.export-btn {
  transition: all 0.2s ease;
}

.export-btn:hover {
  transform: translateY(-2px);
}

.export-btn:active {
  transform: translateY(0);
}

/* Novos estilos para a logo */
.login-logo {
  max-width: 220px;
  height: auto;
  margin-bottom: 15px;
  animation: fadeIn 1.2s ease-out;
}

.logo-img {
  height: 40px;
  width: auto;
  margin-right: 10px;
  transition: all var(--transition-speed) ease;
}

.sidebar.collapsed .logo-img {
  margin-right: 0;
}

/* Estilização dos cards com a nova paleta */
.metric-card:nth-child(1) .metric-icon {
  background: var(--gradient-primary);
}

.metric-card:nth-child(2) .metric-icon {
  background: var(--gradient-secondary);
}

.metric-card:nth-child(3) .metric-icon {
  background: var(--gradient-tertiary);
}

.metric-card:nth-child(4) .metric-icon {
  background: var(--gradient-primary);
}

/* Ajustes de cores específicos */
.notification-badge {
  background: var(--primary-light);
}

.text-primary {
  color: var(--primary) !important;
}

.text-success {
  color: var(--secondary) !important;
}

.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* Estilização para links */
a {
  color: var(--primary);
  transition: color 0.3s ease;
}

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