/**
 * ThreatScout Base Styles
 * Core styles for the application layout and components
 */

/* ===================================
   Base & Layout
   =================================== */

html {
  height: -webkit-fill-available;
}

body {
  background-color: #08081A;
  color: #E2E8F0;
  font-family: 'Inter', sans-serif;
  position: relative;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

/* Animated background grid - DISABLED */
/* body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(28, 168, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 168, 255, 0.03) 1px, transparent 1px);
  background-size: 100px 100px;
  animation: float 20s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
} */

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* ===================================
   Glassmorphism Effects
   =================================== */

.glass {
  background: rgba(16, 16, 40, 0.4);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-strong {
  background: rgba(16, 16, 40, 0.7);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ===================================
   Sidebar Styles
   =================================== */

.sidebar-item {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.sidebar-item.active {
  background: linear-gradient(135deg, rgba(28, 168, 255, 0.2) 0%, rgba(77, 195, 255, 0.1) 100%);
  border-left: 3px solid #1CA8FF;
  box-shadow: 0 4px 15px rgba(28, 168, 255, 0.2);
  transform: translateX(4px);
}

.sidebar-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(28, 168, 255, 0.1), transparent);
  transition: left 0.5s;
}

.sidebar-item:hover::before {
  left: 100%;
}

.sidebar-item:hover {
  background: rgba(28, 168, 255, 0.05);
  transform: translateX(2px);
}

.sidebar-transition {
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Hide text when sidebar is collapsed */
[x-cloak] {
  display: none !important;
}

/* ===================================
   Sidebar Collapsed State Enhancements
   =================================== */

/* Section dividers for collapsed sidebar */
.sidebar-section-divider {
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 20%,
    rgba(255, 255, 255, 0.1) 80%,
    transparent 100%
  );
  margin: 8px 8px;
}

/* Section container for collapsed state */
.sidebar-collapsed-section {
  position: relative;
  padding: 4px 0;
  margin: 2px 4px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
}

.sidebar-collapsed-section::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 0 2px 2px 0;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.sidebar-collapsed-section:hover::before {
  opacity: 1;
}

/* Section color coding - matching expanded state dot colors */
.sidebar-collapsed-section--cases::before {
  background: #60a5fa; /* blue-400 */
}

.sidebar-collapsed-section--hunting::before {
  background: #c084fc; /* purple-400 */
}

.sidebar-collapsed-section--metrics::before {
  background: #fb923c; /* orange-400 */
}

.sidebar-collapsed-section--settings::before {
  background: #4ade80; /* green-400 */
}

.sidebar-collapsed-section--favorites::before {
  background: #fbbf24; /* yellow-400 */
}

/* Badge positioning for collapsed state */
.sidebar-collapsed-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 4px;
  background: rgba(127, 29, 29, 0.5); /* red-900/50 - faded dark red */
  color: #fca5a5; /* red-300 */
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3), 0 0 20px rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.5); /* red-500/50 */
}

/* Badge for expanded state */
.sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  min-width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  border-radius: 9px;
  background: rgba(127, 29, 29, 0.5); /* red-900/50 - faded dark red */
  color: #fca5a5; /* red-300 */
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.25), 0 0 16px rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.5); /* red-500/50 */
}

/* Star/favorite icon styling */
.sidebar-star {
  transition: all 0.2s ease;
}

.sidebar-star:hover {
  transform: scale(1.1);
}

.sidebar-star--active {
  color: #fbbf24;
  fill: #fbbf24;
}

/* ===================================
   Typography
   =================================== */

.gradient-text {
  background: linear-gradient(135deg, #1CA8FF 0%, #38BDF8 40%, #818CF8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* ===================================
   Scrollbar
   =================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(8, 8, 26, 0.5);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #1CA8FF, #4DC3FF);
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(28, 168, 255, 0.3);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #4DC3FF, #80E7FF);
}

/* ===================================
   Animations
   =================================== */

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

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

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.animate-fadeIn {
  animation: fadeInScale 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.animate-slideIn {
  animation: slideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.delay-1 { animation-delay: 0.1s; opacity: 0; }
.delay-2 { animation-delay: 0.2s; opacity: 0; }
.delay-3 { animation-delay: 0.3s; opacity: 0; }
.delay-4 { animation-delay: 0.4s; opacity: 0; }

/* ===================================
   Buttons
   =================================== */

.btn-primary {
  background: linear-gradient(135deg, #1CA8FF, #4DC3FF);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(28, 168, 255, 0.4);
}

/* ===================================
   Modals
   =================================== */

.modal-backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}

@keyframes modalEnter {
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===================================
   Loading States
   =================================== */

.htmx-request {
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

/* ===================================
   Security Themed Elements
   =================================== */

.security-border {
  border: 1px solid rgba(28, 168, 255, 0.3);
  box-shadow:
    0 0 20px rgba(28, 168, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.data-flow {
  position: relative;
  overflow: hidden;
}

.data-flow::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(28, 168, 255, 0.4), transparent);
  animation: data-stream 2s linear infinite;
}

@keyframes data-stream {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* ===================================
   Forms
   =================================== */

.form-input {
  background: rgba(16, 16, 40, 0.6);
  border: 1px solid rgba(75, 85, 99, 0.4);
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}

.form-input:focus {
  border-color: #1CA8FF;
  box-shadow: 0 0 0 3px rgba(28, 168, 255, 0.1);
  background: rgba(16, 16, 40, 0.8);
}

/* ===================================
   ASIM Data Mapping Styles
   =================================== */

.asim-field-tag {
  @apply flex items-center justify-between p-2 bg-gray-700/50 hover:bg-gray-600/50 rounded cursor-pointer text-xs transition-colors;
}

.asim-field-tag .field-name {
  @apply text-blue-400 font-mono;
}

.asim-field-tag .field-type {
  @apply text-gray-400 text-xs;
}

.asim-field-tag:hover .field-name {
  @apply text-blue-300;
}

.asim-source-card input:checked + div {
  @apply border-primary bg-primary/10;
}

.asim-source-card input:checked + div .selected-indicator {
  @apply block;
}

#asim-mode-toggle:checked + div .dot {
  transform: translateX(100%);
  background-color: #3b82f6;
}

#asim-mode-toggle:checked + div .toggle-bg {
  background-color: #1e40af;
}

.dot {
  transition: transform 0.3s ease, background-color 0.3s ease;
}

.toggle-bg {
  transition: background-color 0.3s ease;
}

/* ===================================
   Accessibility
   =================================== */

/* Skip to content link */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: #1CA8FF;
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
  border-radius: 0 0 4px 0;
  font-weight: 600;
}

.skip-to-content:focus {
  top: 0;
}

/* Focus visible styles for better keyboard navigation */
*:focus-visible {
  outline: 2px solid #1CA8FF;
  outline-offset: 2px;
  border-radius: 2px;
}

/* Touch-friendly tap targets for mobile */
@media (max-width: 768px) {
  button,
  a {
    min-width: 44px;
    min-height: 44px;
  }
}

/* ===================================
   Toast Notification Progress Bar
   =================================== */

@keyframes progress {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

.animate-progress {
  animation: progress 5s linear forwards;
}
