/* Traffic SaaS — custom styles complementing Tailwind */

* { -webkit-tap-highlight-color: transparent; }

html, body { font-family: 'Inter', system-ui, -apple-system, sans-serif; }
.font-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* Smooth dark transitions */
html.dark { color-scheme: dark; }
body, .bg-white, .bg-slate-50, .bg-slate-900, .bg-slate-950 {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,0.3);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.5); background-clip: padding-box; border: 2px solid transparent; }

/* Toast */
.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  border: 1px solid rgb(226 232 240);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  font-size: 0.875rem;
  min-width: 280px;
  animation: toast-in .25s ease-out;
}
.dark .toast { background: rgb(15 23 42); border-color: rgb(30 41 59); color: white; }
.toast.success { border-left: 4px solid rgb(34 197 94); }
.toast.error { border-left: 4px solid rgb(239 68 68); }
.toast.info { border-left: 4px solid rgb(59 130 246); }
.toast.warn { border-left: 4px solid rgb(245 158 11); }
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fade-in .2s ease;
}
.modal-panel {
  background: white;
  border-radius: 1rem;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);
  animation: modal-in .25s cubic-bezier(.16,1,.3,1);
}
.dark .modal-panel { background: rgb(15 23 42); border: 1px solid rgb(30 41 59); }
@keyframes fade-in { from {opacity:0} to {opacity:1} }
@keyframes modal-in { from {opacity:0;transform:scale(.97) translateY(6px)} to {opacity:1;transform:scale(1) translateY(0)} }

/* Form inputs consistency */
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid rgb(203 213 225);
  background: white;
  font-size: 0.875rem;
  transition: border-color .15s, box-shadow .15s;
}
.dark .form-input, .dark .form-select, .dark .form-textarea {
  background: rgb(2 6 23);
  border-color: rgb(51 65 85);
  color: rgb(241 245 249);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: rgb(59 130 246);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}
.form-textarea { font-family: inherit; resize: vertical; }

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 500;
  border: 1px solid;
  white-space: nowrap;
}
.badge-success { background: rgb(220 252 231); color: rgb(22 101 52); border-color: rgb(187 247 208); }
.badge-error { background: rgb(254 226 226); color: rgb(153 27 27); border-color: rgb(254 202 202); }
.badge-warn { background: rgb(254 243 199); color: rgb(146 64 14); border-color: rgb(253 230 138); }
.badge-info { background: rgb(219 234 254); color: rgb(30 64 175); border-color: rgb(191 219 254); }
.badge-neutral { background: rgb(241 245 249); color: rgb(51 65 85); border-color: rgb(226 232 240); }
.dark .badge-success { background: rgba(34,197,94,.15); color: rgb(134 239 172); border-color: rgba(34,197,94,.3); }
.dark .badge-error { background: rgba(239,68,68,.15); color: rgb(252 165 165); border-color: rgba(239,68,68,.3); }
.dark .badge-warn { background: rgba(245,158,11,.15); color: rgb(253 224 71); border-color: rgba(245,158,11,.3); }
.dark .badge-info { background: rgba(59,130,246,.15); color: rgb(147 197 253); border-color: rgba(59,130,246,.3); }
.dark .badge-neutral { background: rgb(30 41 59); color: rgb(203 213 225); border-color: rgb(51 65 85); }

/* Switch */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: rgb(203 213 225); border-radius: 9999px;
  transition: .2s;
}
.switch-slider:before {
  content: ''; position: absolute; height: 14px; width: 14px;
  left: 3px; top: 3px; background: white; border-radius: 50%;
  transition: .2s;
}
.switch input:checked + .switch-slider { background: rgb(37 99 235); }
.switch input:checked + .switch-slider:before { transform: translateX(16px); }

/* Log line */
.log-line { padding: 2px 4px; border-radius: 3px; word-break: break-word; }
.log-info { color: rgb(148 163 184); }
.log-success { color: rgb(74 222 128); }
.log-warn { color: rgb(250 204 21); }
.log-error { color: rgb(248 113 113); background: rgba(239,68,68,0.1); }

/* Button helpers */
.btn { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.5rem 0.875rem; font-size: 0.875rem; font-weight: 500; border-radius: 0.5rem; transition: all .15s; cursor: pointer; }
.btn-primary { background: rgb(37 99 235); color: white; }
.btn-primary:hover { background: rgb(29 78 216); }
.btn-secondary { background: white; color: rgb(51 65 85); border: 1px solid rgb(203 213 225); }
.dark .btn-secondary { background: rgb(15 23 42); color: rgb(203 213 225); border-color: rgb(51 65 85); }
.btn-secondary:hover { background: rgb(248 250 252); }
.dark .btn-secondary:hover { background: rgb(30 41 59); }
.btn-danger { background: rgb(220 38 38); color: white; }
.btn-danger:hover { background: rgb(185 28 28); }
.btn-ghost { color: rgb(71 85 105); }
.btn-ghost:hover { background: rgb(241 245 249); }
.dark .btn-ghost { color: rgb(148 163 184); }
.dark .btn-ghost:hover { background: rgb(30 41 59); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Skeleton */
.skel {
  background: linear-gradient(90deg, rgb(241 245 249) 25%, rgb(226 232 240) 37%, rgb(241 245 249) 63%);
  background-size: 400% 100%;
  animation: skel 1.4s ease infinite;
  border-radius: 0.5rem;
}
.dark .skel { background: linear-gradient(90deg, rgb(30 41 59) 25%, rgb(51 65 85) 37%, rgb(30 41 59) 63%); background-size: 400% 100%; }
@keyframes skel { 0%{background-position:100% 50%} 100%{background-position:0 50%} }

/* Empty state */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: rgb(100 116 139);
}
.empty-icon {
  width: 48px; height: 48px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: rgb(241 245 249);
  display: flex; align-items: center; justify-content: center;
}
.dark .empty-icon { background: rgb(30 41 59); }

/* Heatmap cells */
.heatmap-cell {
  width: 22px; height: 22px;
  border-radius: 3px;
  background: rgb(241 245 249);
}
.dark .heatmap-cell { background: rgb(30 41 59); }
