@import "tailwindcss";

/* ═══════════════════════════════════════════════════════════════════════════
   SOCIOWIRE - Custom Theme & Components (Tailwind v4)
   ═══════════════════════════════════════════════════════════════════════════ */

@theme {
  /* Primary accent - Clean blue */
  --color-accent: #60a5fa;
  --color-accent-light: #93c5fd;
  --color-accent-dark: #3b82f6;
  --color-accent-glow: rgba(96, 165, 250, 0.4);

  /* Surface colors - Dark slate */
  --color-surface-50: #f8fafc;
  --color-surface-100: #f1f5f9;
  --color-surface-200: #e2e8f0;
  --color-surface-300: #cbd5e1;
  --color-surface-400: #94a3b8;
  --color-surface-500: #64748b;
  --color-surface-600: #475569;
  --color-surface-700: #334155;
  --color-surface-800: #1e293b;
  --color-surface-900: #0f172a;
  --color-surface-950: #020617;

  /* Glass backgrounds */
  --color-glass-light: rgba(248, 250, 252, 0.98);
  --color-glass-dark: rgba(15, 23, 42, 0.97);
  --color-glass-blue: rgba(15, 23, 42, 0.98);
  --color-glass-card: rgba(30, 41, 59, 0.9);
  --color-glass-card-hover: rgba(51, 65, 85, 0.95);

  /* Category colors */
  --color-category-news: #60a5fa;
  --color-category-breaking: #ef4444;
  --color-category-market: #f59e0b;
  --color-category-friends: #10b981;
  --color-category-events: #60a5fa;
  --color-category-finance: #06b6d4;
  --color-category-live: #ef4444;
  --color-category-video: #38bdf8;
  --color-category-image: #34d399;

  /* Shadows - Blue glow */
  --shadow-glass: 0 4px 32px rgba(0, 0, 0, 0.4), 0 0 30px rgba(96, 165, 250, 0.08);
  --shadow-glass-hover: 0 8px 48px rgba(0, 0, 0, 0.5), 0 0 40px rgba(96, 165, 250, 0.15);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.15);
  --shadow-card-hover: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 32px rgba(96, 165, 250, 0.12);
  --shadow-glow: 0 0 20px rgba(96, 165, 250, 0.5);
  --shadow-glow-sm: 0 0 10px rgba(96, 165, 250, 0.4);

  /* Animations */
  --animate-shimmer: shimmer 2s linear infinite;
  --animate-fade-in: fadeIn 0.3s ease-out;
  --animate-slide-up: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --animate-scale-in: scaleIn 0.2s ease-out;
  --animate-live-pulse: livePulse 1.5s ease-in-out infinite;

  /* Blur */
  --blur-glass: 20px;
}

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

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes slideUp {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  0% { opacity: 0; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Base Styles
   ───────────────────────────────────────────────────────────────────────────── */

html {
  scroll-behavior: smooth;
}

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

::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
}

::-webkit-scrollbar-thumb {
  background: rgba(96, 165, 250, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(96, 165, 250, 0.5);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Component Classes
   ───────────────────────────────────────────────────────────────────────────── */

/* Glass Card */
.glass-card {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  background: var(--color-glass-card);
  backdrop-filter: blur(var(--blur-glass));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-card);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  background: var(--color-glass-card-hover);
  border-color: rgba(96, 165, 250, 0.25);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-4px);
}

/* Glass Panel */
.glass-panel {
  border-radius: 1.5rem;
  padding: 1.25rem;
  background: var(--color-glass-dark);
  backdrop-filter: blur(var(--blur-glass));
  border: 1px solid rgba(59, 130, 246, 0.2);
  box-shadow: var(--shadow-glass);
}

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, #60a5fa, #38bdf8, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Button Base */
.btn-glass {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(71, 85, 105, 0.2);
  color: var(--color-surface-300);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-glass:hover {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.3);
  color: var(--color-accent);
  transform: translateY(-1px);
}

.btn-glass:active {
  transform: scale(0.95);
}

.btn-glass.active {
  background: rgba(96, 165, 250, 0.2);
  border-color: rgba(96, 165, 250, 0.4);
  color: var(--color-accent);
  box-shadow: var(--shadow-glow-sm);
}

/* Avatar with gradient ring */
.avatar-ring {
  position: relative;
  border-radius: 9999px;
  padding: 2px;
  background: linear-gradient(135deg, #60a5fa, #38bdf8, #06b6d4);
  box-shadow: var(--shadow-glow-sm);
}

.avatar-ring img {
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  object-fit: cover;
  background: var(--color-surface-900);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(96, 165, 250, 0.15);
  color: var(--color-accent-light);
  border: 1px solid rgba(96, 165, 250, 0.25);
  box-shadow: var(--shadow-glow-sm);
}

.badge-news {
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.3);
}

.badge-breaking {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2));
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.badge-market {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
}

.badge-friends {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(22, 163, 74, 0.2));
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.3);
}

.badge-events {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.2), rgba(139, 92, 246, 0.2));
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.3);
}

.badge-live {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.2), rgba(239, 68, 68, 0.2));
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.3);
}

/* Live indicator */
.live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  animation: livePulse 1.5s ease-in-out infinite;
}

/* Line clamp utilities */
.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;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Enhanced Theme System - Dark/Blue/Light modes
   ───────────────────────────────────────────────────────────────────────────── */

/* Theme variables - Blue (default) */
:root,
body[data-theme="blue"] {
  --theme-bg-primary: #020617;
  --theme-bg-secondary: #0f172a;
  --theme-bg-tertiary: #1e293b;
  --theme-bg-elevated: #334155;
  --theme-text-primary: #f8fafc;
  --theme-text-secondary: #cbd5e1;
  --theme-text-muted: #64748b;
  --theme-border: rgba(96, 165, 250, 0.2);
  --theme-border-hover: rgba(96, 165, 250, 0.4);
  --theme-accent: #60a5fa;
  --theme-accent-soft: rgba(96, 165, 250, 0.2);
  --theme-gradient-start: #0f172a;
  --theme-gradient-end: #020617;
  --theme-glow: rgba(96, 165, 250, 0.4);
}

/* Theme variables - Dark */
body[data-theme="dark"] {
  --theme-bg-primary: #0a0a0f;
  --theme-bg-secondary: #141420;
  --theme-bg-tertiary: #1e1e2e;
  --theme-bg-elevated: #2a2a3d;
  --theme-text-primary: #f5f5f7;
  --theme-text-secondary: #a0a0b0;
  --theme-text-muted: #666680;
  --theme-border: rgba(255, 255, 255, 0.1);
  --theme-border-hover: rgba(96, 165, 250, 0.3);
  --theme-accent: #60a5fa;
  --theme-accent-soft: rgba(96, 165, 250, 0.15);
  --theme-gradient-start: #141420;
  --theme-gradient-end: #0a0a0f;
  --theme-glow: rgba(96, 165, 250, 0.3);
}

/* Theme variables - Light */
body[data-theme="light"] {
  --theme-bg-primary: #ffffff;
  --theme-bg-secondary: #f8fafc;
  --theme-bg-tertiary: #f1f5f9;
  --theme-bg-elevated: #ffffff;
  --theme-text-primary: #0f172a;
  --theme-text-secondary: #475569;
  --theme-text-muted: #94a3b8;
  --theme-border: rgba(96, 165, 250, 0.15);
  --theme-border-hover: rgba(96, 165, 250, 0.3);
  --theme-accent: #3b82f6;
  --theme-accent-soft: rgba(59, 130, 246, 0.1);
  --theme-gradient-start: #ffffff;
  --theme-gradient-end: #f8fafc;
  --theme-glow: rgba(59, 130, 246, 0.25);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Theme-aware components
   ───────────────────────────────────────────────────────────────────────────── */

/* Themed container */
.themed-container {
  background: linear-gradient(180deg, var(--theme-gradient-start), var(--theme-gradient-end));
  color: var(--theme-text-primary);
}

/* Themed card */
.themed-card {
  background: var(--theme-bg-elevated);
  border: 1px solid var(--theme-border);
  border-radius: 1rem;
  transition: all 0.3s ease;
}

.themed-card:hover {
  border-color: var(--theme-border-hover);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 0 16px var(--theme-glow);
}

/* Themed text */
.text-themed-primary { color: var(--theme-text-primary); }
.text-themed-secondary { color: var(--theme-text-secondary); }
.text-themed-muted { color: var(--theme-text-muted); }
.text-themed-accent { color: var(--theme-accent); }

/* Themed backgrounds */
.bg-themed-primary { background: var(--theme-bg-primary); }
.bg-themed-secondary { background: var(--theme-bg-secondary); }
.bg-themed-elevated { background: var(--theme-bg-elevated); }
.bg-themed-accent { background: var(--theme-accent-soft); }

/* Themed borders */
.border-themed { border-color: var(--theme-border); }
.border-themed-hover:hover { border-color: var(--theme-border-hover); }

/* ─────────────────────────────────────────────────────────────────────────────
   Improved Contrast Utilities
   ───────────────────────────────────────────────────────────────────────────── */

/* High contrast text for accessibility */
.text-high-contrast {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

body[data-theme="light"] .text-high-contrast {
  color: #0f172a;
  text-shadow: none;
}

/* Readable text on images */
.text-on-image {
  color: #ffffff;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.8),
    0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Focus ring for accessibility */
.focus-ring:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--theme-accent-soft), 0 0 0 5px var(--theme-accent);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Interactive Elements
   ───────────────────────────────────────────────────────────────────────────── */

/* Hover lift effect */
.hover-lift {
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.25s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
}

/* Press scale effect */
.press-scale {
  transition: transform 0.15s ease;
}

.press-scale:active {
  transform: scale(0.97);
}

/* Glow on hover */
.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px var(--theme-glow);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Status & State Indicators
   ───────────────────────────────────────────────────────────────────────────── */

/* Online indicator */
.status-online {
  position: relative;
}

.status-online::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--theme-bg-primary);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

/* New content indicator */
.has-new::before {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: livePulse 1.5s ease-in-out infinite;
}

/* Loading shimmer overlay */
.shimmer-overlay {
  position: relative;
  overflow: hidden;
}

.shimmer-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.05) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Spacing & Layout Helpers
   ───────────────────────────────────────────────────────────────────────────── */

/* Safe area padding for mobile */
.safe-area-top { padding-top: env(safe-area-inset-top, 0); }
.safe-area-bottom { padding-bottom: env(safe-area-inset-bottom, 0); }
.safe-area-left { padding-left: env(safe-area-inset-left, 0); }
.safe-area-right { padding-right: env(safe-area-inset-right, 0); }

/* Content container with max-width */
.content-container {
  width: 100%;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .content-container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Motion & Transitions
   ───────────────────────────────────────────────────────────────────────────── */

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

/* Smooth entrance animations */
@keyframes enterFromBottom {
  0% {
    opacity: 0;
    transform: translateY(16px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes enterFromLeft {
  0% {
    opacity: 0;
    transform: translateX(-16px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes enterFromRight {
  0% {
    opacity: 0;
    transform: translateX(16px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-enter-bottom {
  animation: enterFromBottom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-enter-left {
  animation: enterFromLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-enter-right {
  animation: enterFromRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Scrollbar Utilities
   ───────────────────────────────────────────────────────────────────────────── */

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Thin scrollbar */
.scrollbar-thin {
  scrollbar-width: thin;
}

.scrollbar-thin::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
  background: rgba(96, 165, 250, 0.3);
  border-radius: 2px;
}

/* Handwriting font for polaroid captions */
.font-handwriting {
  font-family: 'Caveat', 'Segoe Script', 'Comic Sans MS', cursive;
  font-weight: 500;
}
