/* SubTrack - Advanced Theme System with 10 Visual Features */

/* ==================== Theme Variables ==================== */

/* Default Theme - Ocean Blue with Gradients */
:root, [data-theme="light"], [data-theme="default"] {
  /* Primary gradients */
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  
  /* Background with subtle texture */
  --bg-pattern: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  
  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  
  /* Animated gradient border */
  --border-gradient: linear-gradient(60deg, #f79533, #f37055, #ef4e7b, #a166ab, #5073b8, #1098ad, #07b39b, #6fba82);
}

/* Subtle background pattern overlay */
body {
  background-image: var(--bg-pattern);
  background-attachment: fixed;
}


/* Feature 1: Animated Gradient Background - Enhanced */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea, #764ba2, #5B7FFF, #00C9A7);
  background-size: 400% 400%;
  opacity: 0.06;
  filter: blur(80px);
  transform: scale(1.2);
  z-index: -2;
  pointer-events: none;
}

/* Secondary animated layer for depth */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(91, 127, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(0, 201, 167, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(118, 75, 162, 0.04) 0%, transparent 60%);
  z-index: -1;
  pointer-events: none;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  25% { background-position: 50% 100%; }
  50% { background-position: 100% 50%; }
  75% { background-position: 50% 0%; }
  100% { background-position: 0% 50%; }
}

@keyframes breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

/* Feature 2: Floating Particles Background */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.6;
}

.particle {
  position: absolute;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0) 70%);
  border-radius: 50%;
  opacity: 0.5;
}

.particle:nth-child(1) {
  width: 80px;
  height: 80px;
  top: 10%;
  left: 10%;
  animation-delay: 0s;
  animation-duration: 25s;
}

.particle:nth-child(2) {
  width: 60px;
  height: 60px;
  top: 60%;
  left: 80%;
  animation-delay: 2s;
  animation-duration: 20s;
}

.particle:nth-child(3) {
  width: 100px;
  height: 100px;
  top: 80%;
  left: 20%;
  animation-delay: 4s;
  animation-duration: 30s;
}

.particle:nth-child(4) {
  width: 70px;
  height: 70px;
  top: 30%;
  left: 70%;
  animation-delay: 1s;
  animation-duration: 22s;
}

.particle:nth-child(5) {
  width: 90px;
  height: 90px;
  top: 50%;
  left: 50%;
  animation-delay: 3s;
  animation-duration: 28s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0.3;
  }
  25% {
    transform: translate(30px, -30px) rotate(90deg);
    opacity: 0.6;
  }
  50% {
    transform: translate(-20px, 20px) rotate(180deg);
    opacity: 0.4;
  }
  75% {
    transform: translate(40px, 10px) rotate(270deg);
    opacity: 0.5;
  }
}

/* Feature 3: Glassmorphism Cards */
.card-glass {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  border: 1px solid var(--glass-border) !important;
  box-shadow: var(--glass-shadow) !important;
}

/* Feature 4: Gradient Buttons */
.btn-gradient {
  background: var(--gradient-primary) !important;
  border: none !important;
  color: white !important;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

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

.btn-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

/* Feature 5: Animated Gradient Border Cards */
.card-border-gradient {
  position: relative;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.card-border-gradient::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--radius-lg);
  padding: 2px;
  background: var(--border-gradient);
  background-size: 300% 300%;
  animation: gradientBorder 3s ease infinite;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

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

/* Feature 6: Neon Glow Effects */
.glow-primary {
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.6),
              0 0 40px rgba(102, 126, 234, 0.4),
              0 0 60px rgba(102, 126, 234, 0.2);
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6),
                0 0 40px rgba(102, 126, 234, 0.4),
                0 0 60px rgba(102, 126, 234, 0.2);
  }
  50% {
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.8),
                0 0 60px rgba(102, 126, 234, 0.6),
                0 0 90px rgba(102, 126, 234, 0.4);
  }
}

/* Feature 7: Gradient Text */
.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

/* Feature 8: Shimmer Loading Effect */
.shimmer {
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0) 0%, 
    rgba(255, 255, 255, 0.2) 20%, 
    rgba(255, 255, 255, 0.5) 60%, 
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

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

/* Feature 9: 3D Card Hover */
.card-3d {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  transform-style: preserve-3d;
}

.card-3d:hover {
  transform: translateY(-10px) rotateX(5deg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* Feature 10: Morphing Background Blobs - Enhanced */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.12;
  z-index: -1;
  pointer-events: none;
}

.blob-1 {
  width: 500px;
  height: 500px;
  top: -150px;
  left: -150px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  animation-delay: 0s;
}

.blob-2 {
  width: 600px;
  height: 600px;
  bottom: -200px;
  right: -200px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  animation-delay: 8s;
}

.blob-3 {
  width: 450px;
  height: 450px;
  top: 40%;
  left: 60%;
  background: linear-gradient(135deg, #00C9A7 0%, #00f2fe 100%);
  animation-delay: 16s;
}

/* Additional blob for more visual interest */
.blob-4 {
  width: 350px;
  height: 350px;
  top: 70%;
  left: 10%;
  background: linear-gradient(135deg, #FFaa00 0%, #ff6b6b 100%);
  animation-delay: 12s;
  opacity: 0.15;
}

@keyframes morphBlob {
  0%, 100% {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    transform: scale(1) translate(0, 0) rotate(0deg);
  }
  25% {
    border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    transform: scale(1.15) translate(60px, 40px) rotate(90deg);
  }
  50% {
    border-radius: 40% 60% 60% 40% / 70% 50% 60% 30%;
    transform: scale(0.85) translate(-40px, 60px) rotate(180deg);
  }
  75% {
    border-radius: 70% 30% 50% 50% / 30% 60% 50% 60%;
    transform: scale(1.1) translate(40px, -50px) rotate(270deg);
  }
}

/* ==================== Theme Variations ==================== */

/* Sunset Theme */
[data-theme="sunset"] {
  --gradient-primary: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
  --gradient-secondary: linear-gradient(135deg, #ee5a6f 0%, #f29263 100%);
  --gradient-success: linear-gradient(135deg, #ff9068 0%, #fd746c 100%);
}

[data-theme="sunset"] body::before {
  background: linear-gradient(-45deg, #ff6b6b, #feca57, #ee5a6f, #f29263);
  background-size: 400% 400%;
}

/* Midnight Theme */
[data-theme="midnight"] {
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-secondary: linear-gradient(135deg, #141e30 0%, #243b55 100%);
  --gradient-success: linear-gradient(135deg, #0f2027 0%, #203a43 0%, #2c5364 100%);
}

[data-theme="midnight"] body::before {
  background: linear-gradient(-45deg, #141e30, #243b55, #0f2027, #2c5364);
  background-size: 400% 400%;
}

/* Forest Theme */
[data-theme="forest"] {
  --gradient-primary: linear-gradient(135deg, #134e5e 0%, #71b280 100%);
  --gradient-secondary: linear-gradient(135deg, #0f9b0f 0%, #56ab2f 100%);
  --gradient-success: linear-gradient(135deg, #2c5364 0%, #203a43 100%);
}

[data-theme="forest"] body::before {
  background: linear-gradient(-45deg, #134e5e, #71b280, #0f9b0f, #56ab2f);
  background-size: 400% 400%;
}

/* Candy Theme */
[data-theme="candy"] {
  --gradient-primary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-secondary: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  --gradient-success: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
}

[data-theme="candy"] body::before {
  background: linear-gradient(-45deg, #f093fb, #f5576c, #fa709a, #fee140);
  background-size: 400% 400%;
}

/* Aurora Theme */
[data-theme="aurora"] {
  --gradient-primary: linear-gradient(135deg, #00c9ff 0%, #92fe9d 100%);
  --gradient-secondary: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  --gradient-success: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%);
}

[data-theme="aurora"] body::before {
  background: linear-gradient(-45deg, #00c9ff, #92fe9d, #a8edea, #fed6e3);
  background-size: 400% 400%;
}

/* ==================== Apply Effects to Existing Elements ==================== */

/* Solid card backgrounds — prevents content overlap and improves scroll performance */
.card {
  background: var(--color-bg-secondary);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Gradient buttons - Non-conflicting enhancement */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary.gradient-enhanced {
  background: var(--gradient-primary) !important;
  border: none !important;
}

.btn-gradient::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
  pointer-events: none;
}

.btn-gradient:hover::after {
  width: 300px;
  height: 300px;
}

/* Navbar / Sidebar — solid opaque backgrounds for performance and readability */
.navbar {
  background: var(--color-bg) !important;
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
  z-index: var(--z-sticky);
}

.sidebar {
  background: var(--color-bg);
  border-right: 1px solid var(--glass-border);
  z-index: calc(var(--z-sticky) - 1);
}

/* Badges keep their themed colors from style.css; avoid !important overrides */
.badge-primary.gradient-enhanced {
  background: var(--gradient-primary);
  color: white;
}

.badge-success.gradient-enhanced {
  background: var(--gradient-success);
  color: white;
}

/* Add shimmer to loading states */
.skeleton {
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.3) 50%, 
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

/* ==================== Dark Mode Theme ==================== */
[data-theme="dark"] {
  /* Dark mode gradients */
  --gradient-primary: linear-gradient(135deg, #4c6ef5 0%, #7950f2 100%);
  --gradient-secondary: linear-gradient(135deg, #cc5de8 0%, #e64980 100%);
  --gradient-success: linear-gradient(135deg, #3b9eff 0%, #1098fc 100%);
  --gradient-hero: linear-gradient(135deg, #4c6ef5 0%, #7950f2 50%, #cc5de8 100%);
  
  /* Dark glassmorphism */
  --glass-bg: rgba(20, 20, 25, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
  
  /* Dark particles */
  --particle-color: rgba(122, 155, 255, 0.3);
  --glow-color: rgba(122, 155, 255, 0.5);
  
  /* Dark background pattern - more visible */
  --bg-pattern: radial-gradient(circle at 20% 30%, rgba(76, 110, 245, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 70%, rgba(121, 80, 242, 0.12) 0%, transparent 50%),
                radial-gradient(circle at 50% 90%, rgba(0, 201, 167, 0.08) 0%, transparent 45%);
  
  /* Border gradient for dark mode */
  --border-gradient: linear-gradient(60deg, #4c6ef5, #7950f2, #cc5de8, #e64980, #4c6ef5);
}

/* Dark mode background animation override */
[data-theme="dark"] body::before {
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460, #1a1a2e);
  background-size: 400% 400%;
  opacity: 0.2;
}

[data-theme="dark"] .blob {
  opacity: 0.08;
}

[data-theme="dark"] .blob-1 {
  background: linear-gradient(135deg, #4c6ef5 0%, #7950f2 100%);
}

[data-theme="dark"] .blob-2 {
  background: linear-gradient(135deg, #cc5de8 0%, #e64980 100%);
}

[data-theme="dark"] .blob-3 {
  background: linear-gradient(135deg, #00c9a7 0%, #00d4aa 100%);
}

[data-theme="dark"] .particle {
  background: radial-gradient(circle, var(--particle-color) 0%, transparent 70%);
}

/* ==================== Dark Mode + Visual Theme Combinations ==================== */
/* Sunset in dark mode */
[data-theme="sunset"][data-dark="true"],
[data-theme="dark"][data-visual="sunset"] {
  --gradient-primary: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
}

/* Midnight stays dark-friendly */
[data-theme="midnight"] {
  --glass-bg: rgba(20, 30, 48, 0.9);
  --glass-border: rgba(255, 255, 255, 0.05);
}

/* Forest in dark mode */
[data-theme="forest"] {
  --glass-bg: rgba(19, 78, 94, 0.15);
}

/* Candy in dark mode - soften the colors */
[data-theme="candy"] body::before {
  opacity: 0.08;
}

/* Aurora in dark mode */
[data-theme="aurora"] {
  --glass-bg: rgba(0, 201, 255, 0.08);
}

/* ==================== Enhanced Visual Theme Support for Dark Mode ==================== */
/* Ensure cards remain visible in all themes — solid backgrounds */
.card {
  background: var(--color-bg-secondary);
}

[data-theme="dark"] .card {
  background: var(--color-bg-elevated);
  border-color: var(--color-border);
}

[data-theme="dark"] .card:hover {
  border-color: rgba(122, 155, 255, 0.3);
}

/* Ensure tables are visible in dark mode */
[data-theme="dark"] .table-container {
  background: rgba(30, 30, 35, 0.9);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .table thead {
  background: linear-gradient(180deg, rgba(40, 40, 50, 0.95), rgba(30, 30, 40, 0.95));
}

[data-theme="dark"] .table th::after {
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  opacity: 0.7;
}

/* Enhanced sidebar for dark mode */
[data-theme="dark"] .sidebar {
  background: rgba(20, 20, 25, 0.95);
  border-right-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .sidebar::before {
  opacity: 0.5;
}

/* Enhanced navbar for dark mode - use solid background to prevent content overlap */
[data-theme="dark"] .navbar {
  background: var(--color-bg) !important;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* Modal styling for dark mode */
[data-theme="dark"] .modal-content {
  background: rgba(25, 25, 30, 0.98);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Form inputs for dark mode */
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea {
  background: rgba(40, 40, 50, 0.8);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(122, 155, 255, 0.2);
}

/* Search input for dark mode */
[data-theme="dark"] .search-input {
  background: rgba(40, 40, 50, 0.8);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(122, 155, 255, 0.2), 0 4px 12px -2px rgba(0, 0, 0, 0.3);
}

/* Dropdown for dark mode */
[data-theme="dark"] .dropdown-menu {
  background: rgba(30, 30, 35, 0.98);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .dropdown-item:hover {
  background: rgba(122, 155, 255, 0.15);
}

/* List group for dark mode */
[data-theme="dark"] .list-group-item {
  background: rgba(30, 30, 35, 0.8);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .list-group-item:hover {
  background: rgba(40, 40, 50, 0.9);
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.3);
}

/* Badge styling for dark mode - ensure readability */
[data-theme="dark"] .badge-primary { 
  background: linear-gradient(135deg, rgba(122, 155, 255, 0.25), rgba(121, 80, 242, 0.2)); 
}
[data-theme="dark"] .badge-success { 
  background: linear-gradient(135deg, rgba(0, 227, 159, 0.25), rgba(0, 212, 170, 0.2)); 
}
[data-theme="dark"] .badge-warning { 
  background: linear-gradient(135deg, rgba(255, 184, 0, 0.25), rgba(255, 200, 50, 0.2)); 
}
[data-theme="dark"] .badge-danger { 
  background: linear-gradient(135deg, rgba(255, 82, 123, 0.25), rgba(255, 110, 140, 0.2)); 
}
