@import "tailwindcss";

/* ============================================
   CIVICLENS DESIGN SYSTEM — TAILWIND V4
   ============================================ */

@theme {
  /* ---- Color Palette ---- */
  --color-civic-50: #f0fdf4;
  --color-civic-100: #dcfce7;
  --color-civic-200: #bbf7d0;
  --color-civic-300: #86efac;
  --color-civic-400: #4ade80;
  --color-civic-500: #22c55e;
  --color-civic-600: #16a34a;
  --color-civic-700: #15803d;
  --color-civic-800: #166534;
  --color-civic-900: #14532d;

  --color-ocean-50: #eff6ff;
  --color-ocean-100: #dbeafe;
  --color-ocean-200: #bfdbfe;
  --color-ocean-300: #93c5fd;
  --color-ocean-400: #60a5fa;
  --color-ocean-500: #3b82f6;
  --color-ocean-600: #2563eb;
  --color-ocean-700: #1d4ed8;
  --color-ocean-800: #1e40af;
  --color-ocean-900: #1e3a8a;

  --color-warm-50: #fff7ed;
  --color-warm-100: #ffedd5;
  --color-warm-200: #fed7aa;
  --color-warm-300: #fdba74;
  --color-warm-400: #fb923c;
  --color-warm-500: #f97316;

  --color-blush-50: #fdf2f8;
  --color-blush-100: #fce7f3;
  --color-blush-200: #fbcfe8;
  --color-blush-300: #f9a8d4;
  --color-blush-400: #f472b6;
  --color-blush-500: #ec4899;

  --color-teal-50: #f0fdfa;
  --color-teal-100: #ccfbf1;
  --color-teal-200: #99f6e4;
  --color-teal-300: #5eead4;
  --color-teal-400: #2dd4bf;
  --color-teal-500: #14b8a6;
  --color-teal-600: #0d9488;

  --color-danger-50: #fef2f2;
  --color-danger-100: #fee2e2;
  --color-danger-400: #f87171;
  --color-danger-500: #ef4444;
  --color-danger-600: #dc2626;

  --color-success-50: #f0fdf4;
  --color-success-400: #4ade80;
  --color-success-500: #22c55e;
  --color-success-600: #16a34a;

  --color-warning-50: #fffbeb;
  --color-warning-400: #fbbf24;
  --color-warning-500: #f59e0b;
  --color-warning-600: #d97706;

  --color-info-50: #eff6ff;
  --color-info-400: #60a5fa;
  --color-info-500: #3b82f6;
  --color-info-600: #2563eb;

  /* Dark theme base */
  --color-navy-900: #0a1628;
  --color-navy-800: #0f1d32;
  --color-navy-700: #162240;
  --color-navy-600: #1a2742;
  --color-charcoal-900: #111827;
  --color-charcoal-800: #1a2332;
  --color-charcoal-700: #1f2937;
  --color-charcoal-600: #374151;

  /* Spacing */
  --spacing-18: 4.5rem;
  --spacing-88: 22rem;
  --spacing-120: 30rem;

  /* Border Radius */
  --radius-glass: 1rem;
  --radius-card: 0.875rem;
  --radius-btn: 0.625rem;
  --radius-chip: 2rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-card-hover: 0 8px 40px rgba(0, 0, 0, 0.12);
  --shadow-elevated: 0 12px 48px rgba(0, 0, 0, 0.15);
  --shadow-glow-green: 0 0 20px rgba(34, 197, 94, 0.3);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
  --shadow-glow-teal: 0 0 20px rgba(20, 184, 166, 0.3);

  /* Fonts */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Animations */
  --animate-fade-in: fade-in 0.5s ease-out;
  --animate-slide-up: slide-up 0.5s ease-out;
  --animate-slide-down: slide-down 0.4s ease-out;
  --animate-scale-in: scale-in 0.3s ease-out;
  --animate-shimmer: shimmer 2s infinite linear;
  --animate-float: float 6s ease-in-out infinite;
  --animate-pulse-glow: pulse-glow 2s ease-in-out infinite;
  --animate-typing: typing 3.5s steps(30) infinite;
  --animate-blink: blink 1s step-end infinite;
  --animate-spin-slow: spin 8s linear infinite;
  --animate-bounce-subtle: bounce-subtle 2s ease-in-out infinite;
}

/* ============================================
   KEYFRAMES
   ============================================ */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

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

@keyframes pulse-glow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

@keyframes typing {
  0%, 100% { width: 0; }
  40%, 60% { width: 100%; }
}

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes bounce-subtle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes counter-spin {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

/* ============================================
   BASE STYLES
   ============================================ */
@layer base {
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

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

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

  body {
    font-family: var(--font-sans);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
  }

  /* Light mode (default) */
  :root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --bg-glass-strong: rgba(255, 255, 255, 0.85);
    --bg-card: rgba(255, 255, 255, 0.8);
    --border-glass: rgba(255, 255, 255, 0.3);
    --border-subtle: rgba(0, 0, 0, 0.06);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-inverse: #ffffff;
    --accent-primary: #22c55e;
    --accent-secondary: #14b8a6;
    --accent-glow: rgba(34, 197, 94, 0.15);
    --shadow-color: rgba(0, 0, 0, 0.08);
    --overlay: rgba(0, 0, 0, 0.4);
    --navbar-bg: rgba(255, 255, 255, 0.75);
    --sidebar-bg: rgba(248, 250, 252, 0.95);
  }

  /* Dark mode */
  .dark {
    --bg-primary: #0a1628;
    --bg-secondary: #0f1d32;
    --bg-tertiary: #162240;
    --bg-glass: rgba(15, 29, 50, 0.7);
    --bg-glass-strong: rgba(15, 29, 50, 0.85);
    --bg-card: rgba(22, 34, 64, 0.6);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-inverse: #0f172a;
    --accent-primary: #34d399;
    --accent-secondary: #2dd4bf;
    --accent-glow: rgba(52, 211, 153, 0.15);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --overlay: rgba(0, 0, 0, 0.6);
    --navbar-bg: rgba(10, 22, 40, 0.8);
    --sidebar-bg: rgba(15, 29, 50, 0.95);
  }

  body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
  }

  /* Scrollbar */
  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 3px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
@layer utilities {
  /* Glassmorphism */
  .glass {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
  }

  .glass-strong {
    background: var(--bg-glass-strong);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-glass);
  }

  .glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }

  .glass-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
  }

  /* Text utilities */
  .text-primary { color: var(--text-primary); }
  .text-secondary { color: var(--text-secondary); }
  .text-tertiary { color: var(--text-tertiary); }

  /* Background utilities */
  .bg-primary { background-color: var(--bg-primary); }
  .bg-secondary { background-color: var(--bg-secondary); }
  .bg-tertiary { background-color: var(--bg-tertiary); }

  /* Gradient text */
  .text-gradient {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .text-gradient-warm {
    background: linear-gradient(135deg, #f97316, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  /* Shimmer loading */
  .shimmer {
    background: linear-gradient(
      90deg,
      var(--bg-tertiary) 25%,
      var(--bg-secondary) 50%,
      var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite linear;
  }

  /* Glow effects */
  .glow-green {
    box-shadow: var(--shadow-glow-green);
  }
  .glow-blue {
    box-shadow: var(--shadow-glow-blue);
  }
  .glow-teal {
    box-shadow: var(--shadow-glow-teal);
  }

  /* Hide scrollbar */
  .no-scrollbar::-webkit-scrollbar {
    display: none;
  }
  .no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  /* Line clamp */
  .line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* ============================================
   BRUTALIST AUTH UI (Requested by user)
   ============================================ */
.brutal-auth-form {
  --input-focus: #2d8cf0;
  --font-color: #323232;
  --font-color-sub: #666;
  --bg-color: #fff;
  --main-color: #323232;
  padding: 40px;
  background: #f0f0f0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  border-radius: 5px;
  border: 2px solid var(--main-color);
  box-shadow: 4px 4px var(--main-color);
  width: 100%;
}

.brutal-auth-title {
  color: var(--font-color);
  font-weight: 900;
  font-size: 28px;
  margin-bottom: 25px;
  line-height: 1.2;
}

.brutal-auth-title span {
  color: var(--font-color-sub);
  font-weight: 600;
  font-size: 17px;
}

.brutal-auth-input {
  width: 100%;
  height: 48px;
  border-radius: 5px;
  border: 2px solid var(--main-color);
  background-color: var(--bg-color);
  box-shadow: 4px 4px var(--main-color);
  font-size: 15px;
  font-weight: 600;
  color: var(--font-color);
  padding: 5px 15px;
  outline: none;
  transition: all 0.2s;
}

.brutal-auth-input::placeholder {
  color: var(--font-color-sub);
  opacity: 0.8;
}

.brutal-auth-input:focus {
  border: 2px solid var(--input-focus);
}

.brutal-auth-login-with {
  display: flex;
  gap: 20px;
  margin-top: 10px;
}

.brutal-auth-button-log {
  cursor: pointer;
  width: 48px;
  height: 48px;
  border-radius: 100%;
  border: 2px solid var(--main-color);
  background-color: var(--bg-color);
  box-shadow: 4px 4px var(--main-color);
  color: var(--font-color);
  font-size: 25px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.1s, box-shadow 0.1s;
}

.brutal-auth-icon {
  width: 24px;
  height: 24px;
  fill: var(--main-color);
}

.brutal-auth-button-log:active, .brutal-auth-button-confirm:active {
  box-shadow: 0px 0px var(--main-color);
  transform: translate(3px, 3px);
}

.brutal-auth-button-confirm {
  margin: 30px auto 0 auto;
  width: 100%;
  height: 48px;
  border-radius: 5px;
  border: 2px solid var(--main-color);
  background-color: var(--bg-color);
  box-shadow: 4px 4px var(--main-color);
  font-size: 17px;
  font-weight: 800;
  color: var(--font-color);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

/* ============================================
   LEAFLET MAP OVERRIDES
   ============================================ */
.leaflet-container {
  font-family: var(--font-sans) !important;
  border-radius: var(--radius-card);
}

