:root {
  --intel-blue: #0071c5;
  --intel-dark: #00285a;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --border: #e2e6ef;
  --text: #1f2937;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
}

[data-theme="dark"] {
  --bg: #1a1a2e;
  --panel: #16213e;
  --border: #0f3460;
  --text: #e4e4e7;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  font-family: 'Inter', 'Noto Sans CJK SC', 'Noto Sans CJK JP', 'Noto Sans CJK KR', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--intel-dark), var(--intel-blue));
  color: #fff;
  height: 100vh;
  padding: 20px;
  position: fixed;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 1000;
}

.sidebar.collapsed {
  transform: translateX(-260px);
}

.sidebar h2 {
  margin-bottom: 25px;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  padding: 12px 10px;
  margin-bottom: 6px;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.menu a:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(5px);
}

.menu a.active {
  background: rgba(255, 255, 255, 0.3);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.menu-icon {
  font-size: 1.1rem;
}

.sidebar-logos {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-logos img {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 15px;
  transition: transform 0.3s ease;
}

.sidebar-logos img:hover {
  transform: scale(1.05);
}

/* MAIN CONTENT */
.main {
  flex: 1;
  margin-left: 260px;
  padding: 24px;
  transition: margin-left 0.3s ease;
}

.main.expanded {
  margin-left: 0;
}

/* HEADER */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text);
  transition: all 0.2s;
}

.menu-toggle:hover {
  background: var(--intel-blue);
  color: white;
  transform: scale(1.05);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.language-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
}

.lang-btn {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  width: 32px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.lang-btn img {
  width: 20px;
  height: 14px;
  object-fit: cover;
  border-radius: 2px;
  display: block;
}

.lang-btn:hover {
  background: var(--bg);
}

.lang-btn.active {
  border-color: var(--intel-blue);
  background: rgba(0, 113, 197, 0.12);
}

/* SEARCH BAR */
.search-container {
  position: relative;
  width: 300px;
}

.search-input {
  width: 100%;
  padding: 10px 40px 10px 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.95rem;
  transition: all 0.3s;
}

.search-input:focus {
  outline: none;
  border-color: var(--intel-blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 197, 0.1);
}

.search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 1.1rem;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 8px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  display: none;
  z-index: 1000;
}

.search-results.active {
  display: block;
}

.search-result-item {
  padding: 12px 15px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

.search-result-item:hover {
  background: var(--bg);
}

.search-result-item:last-child {
  border-bottom: none;
}

/* FILTER PERIOD */
.period-filter {
  display: flex;
  gap: 8px;
  background: var(--panel);
  padding: 5px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.period-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.period-btn:hover {
  background: var(--bg);
}

.period-btn.active {
  background: var(--intel-blue);
  color: white;
}

/* THEME TOGGLE */
.theme-toggle {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text);
  transition: all 0.2s;
}

.theme-toggle:hover {
  background: var(--intel-blue);
  color: white;
  transform: scale(1.05);
}

/* NOTIFICATIONS */
.notification-bell {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text);
  transition: all 0.2s;
}

.notification-bell:hover {
  background: var(--intel-blue);
  color: white;
  transform: scale(1.05);
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.notification-panel {
  position: absolute;
  top: 60px;
  right: 24px;
  width: 350px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  display: none;
  z-index: 1000;
  max-height: 500px;
  overflow-y: auto;
}

.notification-panel.active {
  display: block;
  animation: slideDown 0.3s ease;
}

.notification-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notification-item {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.notification-item:hover {
  background: var(--bg);
}

.notification-item.unread {
  background: rgba(0, 113, 197, 0.05);
  border-left: 3px solid var(--intel-blue);
}

/* USER PROFILE */
.user-profile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.user-profile:hover {
  background: var(--bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--intel-blue), var(--intel-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.user-role {
  font-size: 0.75rem;
  color: #6b7280;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  display: none;
  z-index: 1000;
}

.user-dropdown.active {
  display: block;
  animation: slideDown 0.3s ease;
}

.dropdown-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.dropdown-item:hover {
  background: var(--bg);
}

.dropdown-item:last-child {
  border-bottom: none;
  color: var(--danger);
}

/* BUTTONS */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--intel-blue);
  color: white;
}

.btn-primary:hover {
  background: var(--intel-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 113, 197, 0.3);
}

.btn-secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
}

/* CARDS */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.3s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--intel-blue), var(--intel-dark));
  transform: scaleX(0);
  transition: transform 0.3s;
}

.card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
}

.card:hover::before {
  transform: scaleX(1);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card h3 {
  font-size: 0.95rem;
  color: #6b7280;
  font-weight: 500;
}

.card-icon {
  font-size: 1.5rem;
  opacity: 0.3;
}

.value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--intel-blue);
  margin: 12px 0;
}

.trend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.trend.up {
  color: var(--success);
}

.trend.down {
  color: var(--danger);
}

.sparkline {
  width: 100%;
  height: 40px;
  margin-top: 12px;
}

/* GRID */
.grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin: 24px 0;
}

.chart-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.chart-card h3 {
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.chart-container {
  position: relative;
  height: 300px;
}

/* ALERTS */
.alerts-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.alert-item {
  display: flex;
  align-items: start;
  gap: 12px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--bg);
  border-radius: 8px;
  border-left: 3px solid var(--warning);
  transition: all 0.2s;
}

.alert-item:hover {
  transform: translateX(5px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.alert-icon {
  font-size: 1.3rem;
  color: var(--warning);
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.alert-time {
  font-size: 0.75rem;
  color: #6b7280;
}

/* LOADING */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--intel-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* SKELETON */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 8px;
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: 16px;
}

/* TOOLTIPS */
.tooltip {
  position: relative;
}

.tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  font-size: 0.85rem;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  margin-bottom: 8px;
}

.tooltip:hover::before {
  opacity: 1;
}

/* ANIMATIONS */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-260px);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .menu-toggle {
    display: block;
  }

  .search-container {
    width: 100%;
    order: 3;
    flex-basis: 100%;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-right {
    justify-content: space-between;
  }
}

/* SCROLLBAR */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--intel-blue);
}

/* Controles textuais do dashboard, sem emojis. */
.demo-notice {
  margin: 0 0 24px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.6;
}

.menu-toggle,
.theme-toggle,
.notification-bell {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 40px;
}

.lang-btn {
  color: var(--text);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 32px;
  min-height: 32px;
}

.menu-toggle:focus-visible,
.theme-toggle:focus-visible,
.notification-bell:focus-visible,
.lang-btn:focus-visible {
  outline: 2px solid var(--intel-blue);
  outline-offset: 3px;
}

@media print {
  body { display: block; background: white; color: black; }
  .sidebar, .header-right, .menu-toggle, .notification-panel, .user-dropdown,
  .update-toast, .chart-card button, .chart-card .btn-primary { display: none !important; }
  .main { margin: 0; padding: 0; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
  .card, .chart-card, .alerts-card, .demo-notice {
    break-inside: avoid;
    box-shadow: none;
    background: white;
    color: black;
  }
  .value { color: black; }
  .demo-notice { display: block !important; border-color: #555; }
}
