﻿@import url('https://fonts.cdnfonts.com/css/ds-digital');

/**
 * SafeTrack Pro - Design System v2
 * =================================
 * Tema: Sidebar Escuro + Conteúdo Claro
 */

/* ============================================
   VARIABLES
   ============================================ */
:root {
  /* Colors */
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.3);

  --success: #10b981;
  --success-dark: #059669;
  --success-light: #34d399;

  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;

  /* === SIDEBAR (Escuro) === */
  --sidebar-bg: #1e293b;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #f1f5f9;
  --sidebar-glass: rgba(255, 255, 255, 0.05);

  /* === CONTEÚDO (Claro) === */
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-tertiary: #e2e8f0;
  --bg-card: #ffffff;
  --bg-glass: rgba(0, 0, 0, 0.03);

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --border-color: #e2e8f0;
  --border-glow: rgba(99, 102, 241, 0.3);

  /* Sizing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px var(--primary-glow);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* ============================================
   RESET & BASE
   ============================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Remove animated dark background */
body::before {
  display: none;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary);
}

/* ============================================
   LAYOUT - HEADER & NAVBAR
   ============================================ */
.main-top-navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  /* Reduzido de 70px para poupar espaço */
  background: #0f172a;
  /* Fundo sólido opaco */
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.user-profile-header {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Reduzido de 12px */
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 220px;
  /* Limitando largura */
}

.user-info-text {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.user-email {
  font-size: 0.6rem;
  /* Reduzido de 0.7rem */
  color: var(--sidebar-text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 0.8rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.btn-logout-icon {
  background: none;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-logout-icon:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  transform: scale(1.1);
}

/* ============================================
   LAYOUT - SIDEBAR
   ============================================ */
.container-flex {
  display: block;
  /* Uso de block + padding-left é mais seguro para layout fixo */
  min-height: calc(100vh - 60px);
  margin-top: 60px;
  padding-left: 260px;
  /* Offset para a sidebar fixa */
  position: relative;
  transition: padding-left var(--transition-normal);
}

.sidebar {
  position: fixed;
  left: 0;
  top: 60px;
  /* Ajustado para nova altura do header */
  width: 260px;
  /* Levemente reduzido */
  height: calc(100vh - 60px);
  background: #0f172a !important;
  /* Totalmente opaco */
  border-right: 1px solid var(--sidebar-border);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition-normal);
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

#header-server-status.in-sidebar {
  padding: 12px 16px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: block;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 12px;
}

.sidebar-brand .brand-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-brand-name {
  font-size: 0.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--success-light));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}


/* Botão Telegram no rodapé do Sidebar */
.sidebar-telegram-section {
  margin-top: auto;
  padding: 12px 8px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-telegram-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 136, 204, 0.1);
  border: 1px solid rgba(0, 136, 204, 0.25);
  color: #0088cc;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.sidebar-telegram-btn:hover {
  background: rgba(0, 136, 204, 0.2);
  border-color: rgba(0, 136, 204, 0.5);
  transform: translateY(-1px);
}

.sidebar-telegram-btn svg {
  flex-shrink: 0;
}



.app-content {
  padding: 24px;
  width: 100%;
  min-height: calc(100vh - 60px);
  position: relative;
  transition: all var(--transition-normal);
}

body.sidebar-collapsed .container-flex {
  padding-left: 0;
}

body.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

/* Responsive Fixes */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1200;
    /* Acima de tudo no mobile */
  }

  body:not(.sidebar-collapsed) .sidebar {
    transform: translateX(0);
  }

  .app-content {
    margin-left: 0 !important;
  }
}

.sidebar-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--sidebar-border);
  color: var(--sidebar-text-active);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.header-brand-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

/* Brand - Header Version (legado, mantido para branding.js) */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  min-width: 0;
  max-width: 180px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.brand-logo img {
  max-width: 85%;
  max-height: 85%;
  object-fit: contain;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

.brand h2 {
  font-size: 0.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--success-light));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 768px) {
  .brand h2 {
    display: none;
  }

  .brand {
    max-width: 50px;
  }
}

/* Sidebar Top Actions */
.sidebar-top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-glass);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}

#userInfo {
  font-size: 0.85rem;
  color: var(--sidebar-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

/* Menu */
.menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

.menu-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--primary-light);
  transform: scaleY(0);
  transition: transform var(--transition-fast);
}

.menu-item:hover {
  background: var(--sidebar-glass);
  color: var(--sidebar-text-active);
  border-color: var(--sidebar-border);
}

.menu-item:hover::before {
  transform: scaleY(1);
}

.menu-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(99, 102, 241, 0.15));
  color: var(--primary-light);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: var(--shadow-glow);
}

.menu-item.active::before {
  transform: scaleY(1);
}

.menu-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}

/* Submenu */
.submenu {
  display: none;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0 4px 32px;
  padding-left: 12px;
  border-left: 2px solid var(--border-color);
}

.submenu.open {
  display: flex;
}

.submenu-item {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.submenu-item:hover {
  background: var(--sidebar-glass);
  color: var(--sidebar-text-active);
}

/* Notification Badge */
.notif-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

/* ============================================
   MAIN CONTENT
   ============================================ */
/* Consolidated duplicate removed */

/* Page Header */
.page-header {
  margin-bottom: 32px;
}

.page-header .title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-header .subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  color: var(--text-secondary);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--success));
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.stat-card.primary::before {
  background: var(--primary);
}

.stat-card.success::before {
  background: var(--success);
}

.stat-card.warning::before {
  background: var(--warning);
}

.stat-card.danger::before {
  background: var(--danger);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 16px;
  background: var(--bg-glass);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn.success {
  background: linear-gradient(135deg, var(--success), var(--success-dark));
  color: white;
}

.btn.danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
}

.btn.ghost {
  background: var(--bg-glass);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn.ghost:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-muted);
}

.btn.small {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn.logout {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
  padding: 8px 16px;
  font-size: 0.85rem;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.input-field {
  margin-bottom: 20px;
}

.input-field label,
.form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #cadbee !important;
  /* Lighter color for dark backgrounds */
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Specific for light backgrounds (modals sections) */
.bg-light label,
.modal-card label {
  color: #374151 !important;
  /* Dark gray for light backgrounds */
}

.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
  background: var(--bg-tertiary);
}

/* Explicitly dark text for inputs in light containers if needed */
.bg-light .input,
.bg-light select,
.bg-light textarea {
  background: #fff;
  color: #1a202c;
  border-color: #d1d5db;
}

.input::placeholder,
input::placeholder {
  color: var(--text-muted);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.tools {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* Modal Info Boxes - Vibrant Styles */
.alert-box {
  padding: 14px 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.alert-box.success {
  background: #10b981;
  color: #ffffff;
  border: none;
}

.alert-box.danger {
  background: #ef4444;
  color: #ffffff;
  border: none;
}

.alert-box.info {
  background: #3b82f6;
  color: #ffffff;
  border: none;
}

.alert-box svg {
  flex-shrink: 0;
}

/* ============================================
   TABLES
   ============================================ */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
}

.table th {
  background: #e2e8f0;
  color: #1e293b;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 16px;
  text-align: left;
  border-bottom: 2px solid #cbd5e1;
}

.table td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.95rem;
}

.table tr:hover td {
  background: var(--bg-glass);
}

.table tr:last-child td {
  border-bottom: none;
}

/* Table Row States (High Contrast & Vibrant) */
.tr-vencido {
  background: linear-gradient(90deg, #fee2e2, #fecaca) !important;
  color: #991b1b !important;
  font-weight: 700;
  border-left: 5px solid #ef4444 !important;
}

.tr-vencido td {
  color: #991b1b !important;
}

.tr-expiring {
  background: linear-gradient(90deg, #fef3c7, #fde68a) !important;
  color: #92400e !important;
  font-weight: 700;
  border-left: 5px solid #f59e0b !important;
}

.tr-expiring td {
  color: #92400e !important;
}

.tr-regular {
  background: linear-gradient(90deg, #f0fdf4, #dcfce7) !important;
  color: #166534 !important;
  border-left: 5px solid #22c55e !important;
}

.tr-regular td {
  color: #166534 !important;
}

.tr-alerta {
  background: linear-gradient(90deg, #ef4444, #dc2626) !important;
  color: #ffffff !important;
  font-weight: 800;
  border-left: 5px solid #991b1b !important;
}

.tr-alerta td {
  color: #ffffff !important;
}

.tr-parado {
  background: linear-gradient(90deg, #f0f9ff, #e0f2fe) !important;
  color: #075985 !important;
  border-left: 5px solid #0ea5e9 !important;
}

.tr-ligado {
  /* Novo Estilo */
  background: linear-gradient(90deg, #f0f9ff, #dcfce7) !important;
  color: #1e3a8a !important;
  border-left: 5px solid #3b82f6 !important;
}

.tr-parado td {
  color: #075985 !important;
}

.tr-andando {
  background: linear-gradient(90deg, #f0fdf4, #bbf7d0) !important;
  color: #166534 !important;
  border-left: 5px solid #4ade80 !important;
}

.tr-andando td {
  color: #166534 !important;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.primary {
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary-light);
}

.badge.success {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success-light);
}

.badge.warning {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.badge.danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* ============================================
   MODALS
   ============================================ */
.modal-wrap {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  animation: slideUp 0.3s ease;
  box-shadow: var(--shadow-lg);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

/* ============================================
   MAP
   ============================================ */
.map-area {
  width: 100%;
  height: calc(100vh - 200px);
  min-height: 400px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

/* ============================================
   LOADING & TOAST
   ============================================ */
.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  display: none;
  place-items: center;
  z-index: 2000;
}

.loader-card {
  background: var(--bg-card);
  padding: 24px 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-primary);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--transition-normal);
  z-index: 3000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ============================================
   ACTION BUTTONS (Tables)
   ============================================ */
.action-btn-group {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.action-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-glass);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.action-btn.edit:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: var(--primary-light);
}

.action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--danger);
  color: #f87171;
}

.action-btn.history:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--success);
  color: var(--success-light);
}

.action-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

/* ============================================
   PRICING CARDS
   ============================================ */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.price-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.price-card.featured {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.price-card.featured::before {
  content: 'POPULAR';
  position: absolute;
  top: 16px;
  right: -32px;
  background: var(--primary);
  color: white;
  padding: 4px 40px;
  font-size: 0.7rem;
  font-weight: 700;
  transform: rotate(45deg);
}

.price-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
}

.price {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-light);
  margin: 16px 0;
}

.price .per {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ============================================
   IMPROVED RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1200px) {
  .app-content {
    margin-left: 240px;
    width: calc(100% - 240px);
  }

  .sidebar {
    width: 240px;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    height: calc(100vh - 60px);
    top: 60px;
    box-shadow: none;
    z-index: 1000;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }

  .main-top-navbar {
    padding: 0 16px;
  }

  .user-info-text {
    display: none;
    /* Oculta texto para ganhar espaço */
  }

  .app-content {
    margin-left: 0;
    width: 100%;
    padding: 24px 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .container-flex {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    width: 260px;
    height: 100vh;
    z-index: 100;
  }

  /* Evita que o botão Menu cubra o logotipo/nome da empresa */
  .sidebar .brand {
    margin-top: 54px;
  }

  .sidebar.open {
    transform: translateX(0);
    display: flex;
  }

  .app-content {
    margin-left: 0;
    width: 100%;
    padding: 20px 15px;
  }

  .sidebar-toggle {
    position: sticky;
    top: 10px;
    z-index: 101;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .page-header .title {
    font-size: 1.5rem;
  }

  .card {
    padding: 16px;
  }

  .table-responsive {
    font-size: 0.85rem;
  }

  .table th,
  .table td {
    padding: 12px 8px;
  }
}

@media (max-width: 480px) {
  .form-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    margin-bottom: 8px;
  }

  .modal-card {
    max-width: 100%;
    margin: 10px;
    border-radius: var(--radius-md);
  }

  .page-header .title {
    font-size: 1.3rem;
  }

  .brand h2 {
    font-size: 1.1rem;
  }

  .menu-item {
    padding: 12px 14px;
    font-size: 0.9rem;
  }

  .card {
    padding: 14px;
  }
}

/* ============================================
   UTILITIES
   ============================================ */
.w-100 {
  width: 100%;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-1 {
  margin-top: 8px;
}

.mt-2 {
  margin-top: 16px;
}

.mt-3 {
  margin-top: 24px;
}

.mb-1 {
  margin-bottom: 8px;
}

.mb-2 {
  margin-bottom: 16px;
}

.mb-3 {
  margin-bottom: 24px;
}

.hidden {
  display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Selection */
::selection {
  background: var(--primary);
  color: white;
}

/* ============================================
   IMPROVED CONTRAST FOR ACCESSIBILITY
   ============================================ */
/* Ensure sufficient contrast for text elements */
.menu-item {
  color: var(--text-secondary);
}

.menu-item:hover,
.menu-item.active {
  color: var(--text-primary);
}

.submenu-item {
  color: var(--text-muted);
}

.submenu-item:hover {
  color: var(--text-primary);
}

/* Improve contrast for form elements */
.input-field label {
  color: var(--text-secondary);
}

/* Improve contrast for table elements */
.table th {
  background: #e2e8f0 !important;
  color: #1e293b !important;
  font-weight: 700 !important;
}

.table td {
  color: var(--text-primary);
}

/* Ensure proper contrast in dark theme */
.card {
  color: var(--text-primary);
}

.card-body {
  color: var(--text-secondary);
}

/* Contrast improvements for various elements */
.badge {
  color: var(--text-primary);
}

.badge.primary {
  color: var(--primary-light);
}

.badge.success {
  color: var(--success-light);
}

.badge.warning {
  color: var(--warning);
}

.badge.danger {
  color: #f87171;
}

/* Estilos para o módulo Financeiro - Contas a Pagar */
.contas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.conta-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.vehicle-card.status-parado {
  border-left: 4px solid #94a3b8;
}

.vehicle-card.status-movimento {
  border-left: 4px solid #22c55e;
}

.vehicle-card.status-ligado {
  border-left: 4px solid #3b82f6;
}

/* Novo */
.vehicle-card.status-vencido {
  border-left: 4px solid #ef4444;
}

.tr-ligado {
  background-color: #e0f2fe;
}

/* Novo */

.conta-nao-paga {
  border-left: 4px solid #e53e3e;
  /* Vermelho para contas não pagas */
}

.conta-paga {
  border-left: 4px solid #48bb78;
  /* Verde para contas pagas */
  opacity: 0.8;
}

.conta-card h4 {
  margin: 0 0 8px 0;
  font-size: 1.1em;
  color: #2d3748;
}

.conta-card p {
  margin: 4px 0;
  font-size: 0.9em;
  color: #4a5568;
}

.conta-card .valor {
  margin: 8px 0 0 0;
  font-size: 1.1em;
  font-weight: bold;
  color: #2d3748;
}

.status-tag {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8em;
  margin-bottom: 8px;
  display: inline-block;
}

.status-nao-pago {
  background: #fed7d7;
  color: #c53030;
}

.status-pago {
  background: #c6f6d5;
  color: #22543d;
}

.financeiro-btn {
  display: block;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.financeiro-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.financeiro-content {
  display: none;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
}

/* Animação para modais */
@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Loading Screen */

/* Loading Screen */
/* Loading Screen (Now in index.html for faster rendering) */
.fade-out {
  opacity: 0;
  pointer-events: none;
}


/* --- RENEWAL MODAL --- */
#renewal-modal-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.renewal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
}

.renewal-modal {
  position: relative;
  background: #ffffff;
  width: 95%;
  max-width: 1000px;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.4s ease-out;
  text-align: center;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.renewal-header h2 {
  color: #1e293b;
  font-size: 2rem;
  margin-bottom: 10px;
}

.renewal-header p {
  color: #64748b;
  margin-bottom: 30px;
}

.renewal-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 15px;
}

.renewal-plans {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.renewal-plan-card {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px;
  flex: 1;
  min-width: 200px;
  transition: all 0.3s ease;
  position: relative;
}

.renewal-plan-card.highlight {
  border-color: #6366f1;
  background: #eff6ff;
  transform: scale(1.05);
}

.plan-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: #6366f1;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: bold;
}

.plan-emoji {
  font-size: 2rem;
  margin-bottom: 10px;
  display: block;
}

.plan-price {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1e293b;
  margin: 15px 0;
}

.btn-renew {
  width: 100%;
  padding: 12px;
  background: #1e293b;
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-renew:hover {
  background: #334155;
}

.highlight .btn-renew {
  background: #6366f1;
}

.highlight .btn-renew:hover {
  background: #4f46e5;
}

.btn-link {
  background: none;
  border: none;
  color: #64748b;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-link:hover {
  color: #1e293b;
}


/* --- DISCOUNT BADGES --- */
.plan-discount {
  margin: 5px 0 15px 0;
  min-height: 20px;
}

.discount-badge {
  background: #e2e8f0;
  color: #475569;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}

.highlight-discount {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.plan-discount-placeholder {
  margin-bottom: 20px;
  min-height: 20px;
}


/* --- RENEWAL MODAL CONTRAST FIX --- */
.renewal-plan-card h3 {
  color: #1e293b !important;
  font-weight: 800 !important;
  font-size: 1.25rem !important;
  margin: 10px 0 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.renewal-plan-card label {
  color: #1e293b !important;
  font-weight: 700 !important;
}

.renewal-header h2 {
  color: #0f172a !important;
  font-weight: 800 !important;
}

.renewal-header p {
  color: #334155 !important;
  font-weight: 500 !important;
}


/* --- EVIDENCIA DE TEXTO NO MODAL --- */
.renewal-plan-card h3 {
  color: #0f172a !important;
  font-weight: 800 !important;
  font-size: 1.4rem !important;
  -webkit-text-stroke: 0.1px #0f172a;
}

.plan-price {
  color: #1e293b !important;
  font-size: 1.8rem !important;
}

.renewal-header h2 {
  color: #0f172a !important;
}



/* FIX: Modal Overlay Issue */
#renewal-modal-container,
#vehicle-alert-modal-container {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 99999 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.renewal-backdrop {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7) !important;
  z-index: 99998 !important;
}

.renewal-modal {
  position: relative !important;
  z-index: 99999 !important;
}



/* Button Cortesia Admin */
.action-btn.courtesy {
  background-color: #ffffff;
  color: #8b5cf6;
  border: 1px solid #e2e8f0;
}

.action-btn.courtesy:hover {
  background-color: #f8fafc;
  color: #7c3aed;
  border-color: #8b5cf6;
}