/* digatus Portal — Design System with Light & Dark Mode */

/* ========================================
   CSS Custom Properties (Theme Variables)
   ======================================== */

:root {
  /* Brand colors */
  --digatus-green-400: #6fce48;
  --digatus-green-500: #59BB2F;
  --digatus-green-600: #4a9e26;
  --digatus-grey: #464D55;

  /* Dark mode (default) */
  --bg-primary: #040e1a;
  --bg-secondary: #082032;
  --bg-tertiary: #0c2b42;
  --bg-elevated: rgba(8, 32, 50, 0.6);
  --bg-card: rgba(8, 32, 50, 0.4);
  --bg-card-hover: rgba(8, 32, 50, 0.6);
  --bg-card-solid: #0a1c2b;

  --border-primary: rgba(18, 54, 82, 0.5);
  --border-hover: rgba(89, 187, 47, 0.5);
  --border-subtle: rgba(18, 54, 82, 0.3);

  --text-primary: #E0E4E6;
  --text-secondary: rgba(224, 228, 230, 0.7);
  --text-tertiary: rgba(224, 228, 230, 0.5);
  --text-quaternary: rgba(224, 228, 230, 0.4);

  --accent: var(--digatus-green-500);
  --accent-hover: var(--digatus-green-400);
  --accent-subtle: rgba(89, 187, 47, 0.1);

  /* Glass morphism */
  --glass-bg: rgba(4, 14, 26, 0.8);
  --glass-border: rgba(18, 54, 82, 0.5);

  /* Shadows */
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-card-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(89, 187, 47, 0.15);

  /* Scrollbar */
  --scrollbar-track: #040e1a;
  --scrollbar-thumb: #123652;
  --scrollbar-thumb-hover: #1a4467;
}

/* Light mode overrides */
html.light {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-elevated: rgba(255, 255, 255, 0.9);
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-card-solid: #ffffff;

  --border-primary: rgba(15, 23, 42, 0.1);
  --border-hover: rgba(89, 187, 47, 0.5);
  --border-subtle: rgba(15, 23, 42, 0.05);

  --text-primary: #0f172a;
  --text-secondary: rgba(15, 23, 42, 0.8);
  --text-tertiary: rgba(15, 23, 42, 0.6);
  --text-quaternary: rgba(15, 23, 42, 0.5);

  --accent: var(--digatus-green-600);
  --accent-hover: var(--digatus-green-500);
  --accent-subtle: rgba(89, 187, 47, 0.08);

  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(15, 23, 42, 0.1);

  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-card-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(89, 187, 47, 0.1);

  --scrollbar-track: #f1f5f9;
  --scrollbar-thumb: #cbd5e1;
  --scrollbar-thumb-hover: #94a3b8;
}

/* ========================================
   Base Styles
   ======================================== */

* {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

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

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

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* ========================================
   Card Styles
   ======================================== */

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 1rem;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

/* ========================================
   Icon Gradients (Stitch-style)
   ======================================== */

.icon-gradient-green {
  background: linear-gradient(135deg, #a7f3d0 0%, #34d399 50%, #059669 100%);
  color: #064e3b;
}

.icon-gradient-blue {
  background: linear-gradient(135deg, #bfdbfe 0%, #60a5fa 50%, #2563eb 100%);
  color: #1e3a8a;
}

.icon-gradient-purple {
  background: linear-gradient(135deg, #e9d5ff 0%, #c084fc 50%, #9333ea 100%);
  color: #581c87;
}

.icon-gradient-amber {
  background: linear-gradient(135deg, #fef3c7 0%, #fbbf24 50%, #d97706 100%);
  color: #78350f;
}

.icon-gradient-pink {
  background: linear-gradient(135deg, #fbcfe8 0%, #f472b6 50%, #db2777 100%);
  color: #831843;
}

.icon-gradient-cyan {
  background: linear-gradient(135deg, #a5f3fc 0%, #22d3ee 50%, #0891b2 100%);
  color: #164e63;
}

.icon-gradient-orange {
  background: linear-gradient(135deg, #fed7aa 0%, #fb923c 50%, #ea580c 100%);
  color: #7c2d12;
}

.icon-gradient-red {
  background: linear-gradient(135deg, #fecaca 0%, #f87171 50%, #dc2626 100%);
  color: #7f1d1d;
}

.icon-gradient-mint {
  background: linear-gradient(135deg, #d1fae5 0%, #6ee7b7 50%, #10b981 100%);
  color: #064e3b;
}

.icon-gradient-grey {
  background: linear-gradient(135deg, #e5e7eb 0%, #9ca3af 50%, #4b5563 100%);
  color: #1f2937;
}

/* ========================================
   Pill Badges
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-core {
  background-color: rgba(89, 187, 47, 0.15);
  color: var(--digatus-green-500);
}

html.light .badge-core {
  background-color: rgba(89, 187, 47, 0.1);
  color: var(--digatus-green-600);
}

.badge-agent {
  background-color: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

html.light .badge-agent {
  background-color: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

.badge-ops {
  background-color: rgba(249, 115, 22, 0.15);
  color: #f97316;
}

html.light .badge-ops {
  background-color: rgba(249, 115, 22, 0.1);
  color: #ea580c;
}

/* ========================================
   Theme Toggle
   ======================================== */

.theme-toggle {
  position: relative;
  width: 3.5rem;
  height: 2rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-toggle:hover {
  border-color: var(--border-hover);
}

.theme-toggle-slider {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  background-color: var(--bg-elevated);
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

html.light .theme-toggle-slider {
  transform: translateX(1.5rem);
}

.theme-toggle-icon {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

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

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

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

.animate-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

.animate-slide-in {
  animation: slideIn 0.2s ease-out forwards;
}

/* Staggered animation delays for cards */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }

/* ========================================
   Micro-interactions
   ======================================== */

a:hover .fas.fa-arrow-up-right-from-square,
a:hover .fas.fa-arrow-right {
  transform: translate(2px, -2px);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   Responsive Utilities
   ======================================== */

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

/* ========================================
   Reduced Motion
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================
   Focus States (Accessibility)
   ======================================== */

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 0.375rem;
}

/* ========================================
   Background Glow
   ======================================== */

.bg-glow {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.bg-glow::before {
  content: '';
  position: absolute;
  top: -10rem;
  right: -10rem;
  width: 24rem;
  height: 24rem;
  background: radial-gradient(circle, var(--accent-subtle) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(60px);
}

.bg-glow::after {
  content: '';
  position: absolute;
  bottom: -10rem;
  left: -10rem;
  width: 24rem;
  height: 24rem;
  background: radial-gradient(circle, rgba(18, 54, 82, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(60px);
}

html.light .bg-glow::before {
  background: radial-gradient(circle, rgba(89, 187, 47, 0.08) 0%, transparent 70%);
}

html.light .bg-glow::after {
  background: radial-gradient(circle, rgba(15, 23, 42, 0.03) 0%, transparent 70%);
}
