@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Colors */
  --bg-main: #060913;
  --bg-sidebar: #0b1120;
  --bg-card: rgba(15, 22, 42, 0.65);
  --bg-card-hover: rgba(22, 32, 60, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-active: rgba(0, 242, 254, 0.3);
  
  --color-primary: #00f2fe;
  --color-primary-rgb: 0, 242, 254;
  --color-secondary: #7928ca;
  --color-accent: #ff007f;
  
  /* Status Colors */
  --color-safe: #10b981;
  --color-safe-bg: rgba(16, 185, 129, 0.1);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.1);
  --color-danger: #f43f5e;
  --color-danger-bg: rgba(244, 63, 94, 0.15);
  
  /* Text */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  /* Fonts */
  --font-display: 'Outfit', sans-serif;
  --font-sans: 'Plus Jakarta Sans', sans-serif;
  
  /* Shadow & Blur */
  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --neon-glow: 0 0 15px rgba(0, 242, 254, 0.25);
  --neon-glow-danger: 0 0 15px rgba(244, 63, 94, 0.3);
  --glass-blur: blur(12px);
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(121, 40, 202, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(0, 242, 254, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(6, 9, 19, 0.5) 0px, var(--bg-main) 100%);
  background-attachment: fixed;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
aside.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px;
  position: fixed;
  height: 100vh;
  z-index: 100;
  backdrop-filter: var(--glass-blur);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.brand-logo {
  width: 42px;
  height: 42px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-primary), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.nav-item a:hover, .nav-item.active a {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active a {
  background: rgba(0, 242, 254, 0.06);
  border-color: var(--border-color-active);
  color: var(--color-primary);
  box-shadow: inset 0 0 12px rgba(0, 242, 254, 0.05);
}

.nav-item a svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s;
}

.nav-item a:hover svg {
  transform: translateX(2px);
}

/* User Profile in Sidebar */
.user-info {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-family: var(--font-display);
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-details h4 {
  font-size: 0.85rem;
  font-weight: 600;
}

.user-details p {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Main Content Area */
main.main-content {
  margin-left: 280px;
  flex-grow: 1;
  padding: 40px;
  max-width: 1600px;
}

/* Top bar details */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.page-title h1 {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.page-title p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Live Traffic Status Dot */
.live-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-safe);
}

.live-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-safe);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 8px var(--color-safe); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* Views display switching */
.view-panel {
  display: none;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-panel.active {
  display: block;
}

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

/* Cards & Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--card-shadow);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.kpi-card:hover .kpi-icon {
  color: var(--color-primary);
  border-color: var(--border-color-active);
  background: rgba(0, 242, 254, 0.05);
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 6px;
}

.kpi-change {
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-change.up { color: var(--color-danger); }
.kpi-change.down { color: var(--color-safe); }
.kpi-change.neutral { color: var(--text-dim); }

/* Dashboard Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.chart-title h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
}

.chart-title p {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.chart-container {
  position: relative;
  flex-grow: 1;
  min-height: 280px;
}

/* Control Panel / Traffic Simulator styles */
.simulator-widget {
  background: linear-gradient(135deg, rgba(11, 17, 32, 0.8), rgba(6, 9, 19, 0.9));
  border: 1px solid rgba(0, 242, 254, 0.2);
  box-shadow: inset 0 0 15px rgba(0, 242, 254, 0.05), var(--card-shadow);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 32px;
}

.simulator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 12px;
}

.simulator-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-primary);
  font-size: 1.05rem;
}

.simulator-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.simulator-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), #4854ff);
  color: #000;
  box-shadow: var(--neon-glow);
  font-weight: 700;
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: var(--color-danger-bg);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fda4af;
}

.btn-danger:hover {
  background: var(--color-danger);
  color: #fff;
  box-shadow: var(--neon-glow-danger);
}

.btn-warning {
  background: var(--color-warning-bg);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fde047;
}

.btn-warning:hover {
  background: var(--color-warning);
  color: #000;
}

.btn-success {
  background: var(--color-safe-bg);
  border-color: rgba(16, 185, 129, 0.3);
  color: #a7f3d0;
}

.btn-success:hover {
  background: var(--color-safe);
  color: #000;
}

/* Custom Table Styles for Logs & Blocklist */
.table-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.table-header-bar {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.table-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

table.data-table th {
  background: rgba(0, 0, 0, 0.2);
  padding: 14px 20px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

table.data-table td {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  white-space: nowrap;
}

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

table.data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: var(--color-safe-bg);
  color: var(--color-safe);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.badge-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid rgba(244, 63, 94, 0.15);
}

/* Action controls */
.action-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.action-icon-btn:hover {
  color: var(--color-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* Code Snippet Box */
.code-container {
  position: relative;
  background: #020617;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: #38bdf8;
  overflow-x: auto;
  line-height: 1.5;
  margin-top: 16px;
  margin-bottom: 24px;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.code-title {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
}

.code-copy-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.code-copy-btn:hover {
  background: var(--color-primary);
  color: #000;
}

/* Integration Details Grid */
.integration-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .integration-grid {
    grid-template-columns: 1fr;
  }
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
}

.info-card h4 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 12px;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-card p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 12px;
}

.info-card ol {
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.info-card li {
  margin-bottom: 8px;
}

/* Modal Popup Window */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color-active);
  box-shadow: 0 0 30px rgba(0, 242, 254, 0.15), var(--card-shadow);
  border-radius: 20px;
  width: 90%;
  max-width: 600px;
  padding: 32px;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.25rem;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-header {
  margin-bottom: 20px;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-body {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.ip-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  background: rgba(0, 0, 0, 0.2);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.details-item span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.details-item strong {
  color: var(--text-main);
  font-family: var(--font-sans);
}

/* Floating Alerts Center */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
}

.toast {
  background: rgba(11, 17, 32, 0.9);
  border: 1px solid var(--color-danger);
  border-left: 5px solid var(--color-danger);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  padding: 16px;
  width: 320px;
  display: flex;
  gap: 12px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  backdrop-filter: var(--glass-blur);
}

.toast.toast-safe {
  border-color: var(--color-safe);
  border-left-color: var(--color-safe);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-content h4 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-main);
}

.toast-content p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Custom form styles */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: all 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
}

/* Helper flex layout items */
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gap-12 {
  display: flex;
  gap: 12px;
}

.icon-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.risk-level-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.risk-level-fill {
  height: 100%;
  border-radius: 3px;
}
