:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --danger-gradient: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  --warning-gradient: linear-gradient(135deg, #ffd93d 0%, #ffb800 100%);
  --info-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --success-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.5);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.15);
}

body {
  background: #ffffff;
  min-height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  position: relative;
  overflow-x: hidden;
}

/* Animated Grid Background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(102, 126, 234, 0.03) 1.5px, transparent 1.5px),
    linear-gradient(90deg, rgba(102, 126, 234, 0.03) 1.5px, transparent 1.5px);
  background-size: 60px 60px;
  z-index: -2;
  animation: gridMove 30s linear infinite;
}

@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(60px, 60px); }
}

/* Gradient Blobs */
.blob-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.12;
  animation: blobMove 25s ease-in-out infinite;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.blob-2 {
  width: 350px;
  height: 350px;
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  top: 40%;
  right: -80px;
  animation-delay: 8s;
}

.blob-3 {
  width: 450px;
  height: 450px;
  background: linear-gradient(135deg, #f093fb, #f5576c);
  bottom: -150px;
  left: 25%;
  animation-delay: 4s;
}

.blob-4 {
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, #43e97b, #38f9d7);
  top: 60%;
  left: 5%;
  animation-delay: 12s;
}

@keyframes blobMove {
  0%, 100% {
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  25% {
    transform: translate(40px, -40px) scale(1.15) rotate(90deg);
  }
  50% {
    transform: translate(-30px, 30px) scale(0.9) rotate(180deg);
  }
  75% {
    transform: translate(30px, 40px) scale(1.08) rotate(270deg);
  }
}

/* Circuit/Tech Lines */
.circuit-lines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.circuit-line {
  position: absolute;
  background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.15), transparent);
  height: 2px;
  animation: lineMove 18s linear infinite;
}

.circuit-line:nth-child(1) {
  top: 15%;
  width: 400px;
  left: -400px;
  animation-delay: 0s;
}

.circuit-line:nth-child(2) {
  top: 45%;
  width: 500px;
  left: -500px;
  animation-delay: 6s;
}

.circuit-line:nth-child(3) {
  top: 75%;
  width: 350px;
  left: -350px;
  animation-delay: 12s;
}

.circuit-line:nth-child(4) {
  top: 30%;
  width: 300px;
  left: -300px;
  animation-delay: 3s;
}

.circuit-line:nth-child(5) {
  top: 60%;
  width: 450px;
  left: -450px;
  animation-delay: 9s;
}

@keyframes lineMove {
  to { left: 110%; }
}

/* Floating Particles */
.tech-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.tech-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: rgba(102, 126, 234, 0.4);
  border-radius: 50%;
  animation: particleFloat 20s linear infinite;
  opacity: 0;
}

.tech-particle:nth-child(1) {
  left: 15%;
  animation-delay: 0s;
  animation-duration: 15s;
}

.tech-particle:nth-child(2) {
  left: 35%;
  animation-delay: 3s;
  animation-duration: 18s;
}

.tech-particle:nth-child(3) {
  left: 55%;
  animation-delay: 6s;
  animation-duration: 22s;
}

.tech-particle:nth-child(4) {
  left: 75%;
  animation-delay: 2s;
  animation-duration: 16s;
}

.tech-particle:nth-child(5) {
  left: 90%;
  animation-delay: 8s;
  animation-duration: 20s;
}

@keyframes particleFloat {
  0% {
    transform: translateY(110vh) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-10vh) scale(1.5);
    opacity: 0;
  }
}

/* Page Header */
.page-header {
  text-align: center;
  margin-bottom: 2.5rem;
  animation: fadeInDown 0.8s ease-out;
  position: relative;
}

.page-title {
  font-size: 3rem;
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
  display: inline-block;
  position: relative;
}

.page-title::before {
  content: '⚙️';
  position: absolute;
  left: -60px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.5rem;
  animation: spin 8s linear infinite;
}

@keyframes spin {
  from { transform: translateY(-50%) rotate(0deg); }
  to { transform: translateY(-50%) rotate(360deg); }
}

.page-title::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 4px;
  background: var(--primary-gradient);
  border-radius: 2px;
  animation: expandFromCenter 0.8s ease-out 0.3s forwards;
}

@keyframes expandFromCenter {
  from { width: 0; }
  to { width: 120px; }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Glass Card Effect */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(25px) saturate(180%);
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeInUp 0.6s ease-out;
  position: relative;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg 90deg,
    rgba(255, 255, 255, 0.08) 90deg 180deg,
    transparent 180deg 270deg,
    rgba(255, 255, 255, 0.08) 270deg 360deg
  );
  animation: glassRotate 10s linear infinite;
  pointer-events: none;
}

@keyframes glassRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.glass-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-8px) scale(1.01);
  border-color: rgba(102, 126, 234, 0.3);
}

/* Card Headers */
.card-header-gradient {
  background: var(--primary-gradient);
  color: white;
  padding: 1.5rem;
  border: none;
  position: relative;
  overflow: hidden;
}

.card-header-gradient::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: shimmerMove 4s infinite;
}

@keyframes shimmerMove {
  0%, 100% { left: -100%; }
  50% { left: 100%; }
}

.card-header-danger {
  background: var(--danger-gradient);
}

.card-header-warning {
  background: var(--warning-gradient);
}

.card-header-info {
  background: var(--info-gradient);
}

/* Alert Cards */
.alert-modern {
  border: none;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.6s ease-out;
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
}

.alert-modern::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 5px;
  height: 0;
  animation: heightExpand 0.6s ease-out 0.2s forwards;
}

@keyframes heightExpand {
  to { height: 100%; }
}

.alert-danger-modern {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(238, 90, 111, 0.1) 100%);
  border-left: 5px solid transparent;
}

.alert-danger-modern::before {
  background: var(--danger-gradient);
}

.alert-info-modern {
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.1) 0%, rgba(0, 242, 254, 0.1) 100%);
  border-left: 5px solid transparent;
}

.alert-info-modern::before {
  background: var(--info-gradient);
}

.alert-warning-modern {
  background: linear-gradient(135deg, rgba(255, 217, 61, 0.1) 0%, rgba(255, 184, 0, 0.1) 100%);
  border-left: 5px solid transparent;
}

.alert-warning-modern::before {
  background: var(--warning-gradient);
}

/* Badge Styles */
.badge-modern {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  animation: badgePulse 3s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { 
    transform: scale(1); 
    opacity: 1; 
  }
  50% { 
    transform: scale(1.05); 
    opacity: 0.9; 
  }
}

.badge-info-modern {
  background: var(--info-gradient);
  color: white;
  border: none;
}

/* Table Modern */
.table-modern {
  border-collapse: separate;
  border-spacing: 0 1rem;
}

.table-modern thead th {
  background: var(--primary-gradient);
  color: white;
  border: none;
  padding: 1.25rem;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1px;
  position: relative;
}

.table-modern thead th:first-child {
  border-radius: 12px 0 0 12px;
}

.table-modern thead th:last-child {
  border-radius: 0 12px 12px 0;
}

.table-modern thead th::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.5);
  transition: width 0.3s ease;
}

.table-modern thead th:hover::after {
  width: 100%;
}

.table-modern tbody tr {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.6s ease-out;
  animation-fill-mode: both;
}

.table-modern tbody tr:nth-child(1) { animation-delay: 0.1s; }
.table-modern tbody tr:nth-child(2) { animation-delay: 0.15s; }
.table-modern tbody tr:nth-child(3) { animation-delay: 0.2s; }
.table-modern tbody tr:nth-child(4) { animation-delay: 0.25s; }
.table-modern tbody tr:nth-child(5) { animation-delay: 0.3s; }

.table-modern tbody tr:hover {
  transform: translateX(12px) scale(1.02);
  box-shadow: var(--shadow-md);
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
}

.table-modern tbody td {
  padding: 1.25rem;
  border: none;
  vertical-align: middle;
}

.table-modern tbody tr td:first-child {
  border-radius: 12px 0 0 12px;
  border-left: 4px solid transparent;
  transition: all 0.3s ease;
}

.table-modern tbody tr:hover td:first-child {
  border-left-color: #667eea;
  padding-left: 1.5rem;
}

.table-modern tbody tr td:last-child {
  border-radius: 0 12px 12px 0;
}

/* Form Controls */
.config-value {
  border: 2px solid #e8ecef;
  border-radius: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(248, 249, 250, 0.9);
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.config-value:focus {
  border-color: #667eea;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
  transform: scale(1.01);
}

/* Buttons */
.btn-gradient {
  border: none;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-gradient::before {
  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;
}

.btn-gradient:hover::before {
  width: 350px;
  height: 350px;
}

.btn-gradient:hover {
  transform: translateY(-3px);
}

.btn-save {
  background: var(--primary-gradient);
  border-radius: 8px;
  font-weight: 600;
}

.btn-save:hover {
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.btn-save.btn-warning {
  background: var(--warning-gradient);
  animation: saveWarning 2s infinite;
}

@keyframes saveWarning {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(255, 193, 7, 0);
  }
}

.btn-secondary-gradient {
  background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
}

.btn-secondary-gradient:hover {
  box-shadow: 0 8px 24px rgba(108, 117, 125, 0.4);
}

.btn-warning-gradient {
  background: var(--warning-gradient);
}

.btn-warning-gradient:hover {
  box-shadow: 0 8px 24px rgba(255, 193, 7, 0.5);
}

/* Code styling */
code {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.12) 100%);
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  font-weight: 600;
  color: #667eea;
  border: 1px solid rgba(102, 126, 234, 0.2);
  font-family: 'Courier New', monospace;
}

/* Icons */
.icon-spin {
  display: inline-block;
  animation: iconSpinAnim 3s linear infinite;
}

@keyframes iconSpinAnim {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.icon-bounce {
  display: inline-block;
  animation: iconBounce 2s infinite;
}

@keyframes iconBounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-12px); }
  60% { transform: translateY(-6px); }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: rgba(241, 241, 241, 0.5);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-gradient);
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.loading-spinner {
  width: 70px;
  height: 70px;
  border: 6px solid rgba(102, 126, 234, 0.2);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spinnerRotate 1s linear infinite;
}

@keyframes spinnerRotate {
  to { transform: rotate(360deg); }
}

/* Search highlight styles */
.search-match {
  background: rgba(255, 255, 0, 0.1) !important;
  transition: all 0.3s ease;
}

.search-current {
  background: rgba(102, 126, 234, 0.15) !important;
  border-left-color: #667eea !important;
  border-left-width: 5px !important;
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.3) !important;
  animation: highlightPulse 1.5s ease-in-out infinite;
}

@keyframes highlightPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
  }
}

/* ========================================
   ⚙️ SYSTEM CONFIG STYLES
   ======================================== */

/* ✅ Ensure font inheritance */
.config-container,
.config-card,
.form-control,
.table-modern,
.alert-custom {
  font-family: inherit !important;
}

/* ✅ Code/JSON elements stay monospace */
code,
pre,
.code-input,
textarea[name*="value"] {
  font-family: 'Courier New', Consolas, Monaco, monospace !important;
}
