@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Light theme variables */
  --bg-primary: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  --bg-secondary: #f1f5f9;
  --bg-tertiary: rgba(255, 255, 255, 0.9);
  --bg-glass: rgba(255, 255, 255, 0.15);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-light: rgba(148, 163, 184, 0.2);
  --border-medium: rgba(148, 163, 184, 0.3);
  --border-glow: rgba(59, 130, 246, 0.3);

  --box-default: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  --box-healthy: linear-gradient(135deg, #10b981, #047857);
  --box-unhealthy: linear-gradient(135deg, #ef4444, #dc2626);
  --box-warning: linear-gradient(135deg, #f59e0b, #d97706);
  --box-text: rgba(255, 255, 255, 0.95);
  --box-text-secondary: rgba(255, 255, 255, 0.8);

  --button-primary: linear-gradient(135deg, #3b82f6, #1d4ed8);
  --button-primary-hover: linear-gradient(135deg, #2563eb, #1e40af);
  --button-theme: linear-gradient(135deg, #8b5cf6, #7c3aed);
  --button-theme-hover: linear-gradient(135deg, #7c3aed, #6d28d9);

  /* Modern glow effects */
  --glow-primary: 0 0 20px rgba(59, 130, 246, 0.3);
  --glow-healthy: 0 0 20px rgba(16, 185, 129, 0.4);
  --glow-unhealthy: 0 0 20px rgba(239, 68, 68, 0.4);
  --glow-warning: 0 0 20px rgba(245, 158, 11, 0.4);
  --glow-theme: 0 0 20px rgba(139, 92, 246, 0.4);

  /* Enhanced shadows with glow */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.05);

  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --border-radius-xl: 20px;
}

[data-theme="dark"] {
  /* Dark theme variables */
  --bg-primary: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
  --bg-secondary: #16213e;
  --bg-tertiary: rgba(16, 15, 35, 0.9);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-light: rgba(148, 163, 184, 0.1);
  --border-medium: rgba(148, 163, 184, 0.2);
  --border-glow: rgba(139, 92, 246, 0.4);

  --box-default: linear-gradient(135deg, #1e293b, #334155);
  --box-healthy: linear-gradient(135deg, #10b981, #047857);
  --box-unhealthy: linear-gradient(135deg, #ef4444, #dc2626);
  --box-warning: linear-gradient(135deg, #f59e0b, #d97706);
  --box-text: rgba(255, 255, 255, 0.95);
  --box-text-secondary: rgba(255, 255, 255, 0.8);

  --button-primary: linear-gradient(135deg, #3b82f6, #1d4ed8);
  --button-primary-hover: linear-gradient(135deg, #2563eb, #1e40af);
  --button-theme: linear-gradient(135deg, #f59e0b, #d97706);
  --button-theme-hover: linear-gradient(135deg, #d97706, #b45309);

  /* Enhanced dark theme glows */
  --glow-primary: 0 0 30px rgba(59, 130, 246, 0.4);
  --glow-healthy: 0 0 30px rgba(16, 185, 129, 0.5);
  --glow-unhealthy: 0 0 30px rgba(239, 68, 68, 0.5);
  --glow-warning: 0 0 30px rgba(245, 158, 11, 0.5);
  --glow-theme: 0 0 30px rgba(245, 158, 11, 0.5);

  /* Enhanced dark shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.5), 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  color: var(--text-primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1.5;
  font-feature-settings: 'kern';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.03) 0%, transparent 50%),
              radial-gradient(circle at 20% 80%, rgba(16, 185, 129, 0.02) 0%, transparent 50%);
  animation: float 20s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(30px, -30px) rotate(120deg); }
  66% { transform: translate(-20px, 20px) rotate(240deg); }
}

.main-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 clamp(16px, 4vw, 40px);
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
  padding: 16px 0;
  margin-bottom: 32px;
  box-shadow: var(--shadow-glow);
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-tertiary);
  z-index: -1;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.025em;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auto-refresh-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-light);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.auto-refresh-indicator:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.auto-refresh-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.auto-refresh-dot.active {
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6), 0 0 20px rgba(16, 185, 129, 0.3);
  animation: pulse-glow-dot 2s ease-in-out infinite;
}

.auto-refresh-dot.inactive {
  background: #6b7684;
  animation: none;
}

.auto-refresh-dot.paused {
  background: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.6), 0 0 20px rgba(245, 158, 11, 0.3);
  animation: pulse-glow-warning 3s ease-in-out infinite;
}

.auto-refresh-indicator:hover .auto-refresh-dot.inactive,
.auto-refresh-indicator:hover .auto-refresh-dot.paused {
  transform: scale(1.2);
}

@keyframes pulse-glow-dot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6), 0 0 20px rgba(16, 185, 129, 0.3);
  }
  50% {
    opacity: 0.7;
    transform: scale(0.9);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.8), 0 0 30px rgba(16, 185, 129, 0.4);
  }
}

@keyframes pulse-glow-warning {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.6), 0 0 20px rgba(245, 158, 11, 0.3);
  }
  50% {
    opacity: 0.6;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.8), 0 0 30px rgba(245, 158, 11, 0.4);
  }
}

@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(0.8);
  }
}

@keyframes pulse-slow {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(16px, 3vw, 24px);
  padding-bottom: 40px;
}

.box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backdrop-filter: blur(10px);
}

.box::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-light);
  transition: all 0.3s ease;
}

.box:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl), var(--glow-primary);
  border-color: var(--border-glow);
}

.box:hover::after {
  background: linear-gradient(90deg,
    rgba(59, 130, 246, 0.8) 0%,
    rgba(139, 92, 246, 0.8) 50%,
    rgba(59, 130, 246, 0.8) 100%);
  box-shadow: var(--glow-primary);
}

.box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--box-default);
  transition: all 0.3s ease;
  z-index: 1;
}

.box.healthy::before {
  background: var(--box-healthy);
  box-shadow: var(--glow-healthy);
}

.box.healthy:hover {
  box-shadow: var(--shadow-xl), var(--glow-healthy);
}

.box.healthy:hover::after {
  background: linear-gradient(90deg,
    rgba(16, 185, 129, 0.8) 0%,
    rgba(4, 120, 87, 0.8) 100%);
  box-shadow: var(--glow-healthy);
}

.box.unhealthy::before {
  background: var(--box-unhealthy);
  box-shadow: var(--glow-unhealthy);
}

.box.unhealthy:hover {
  box-shadow: var(--shadow-xl), var(--glow-unhealthy);
}

.box.unhealthy:hover::after {
  background: linear-gradient(90deg,
    rgba(239, 68, 68, 0.8) 0%,
    rgba(220, 38, 38, 0.8) 100%);
  box-shadow: var(--glow-unhealthy);
}

.box.checking {
  border-color: var(--border-medium);
}

.box.checking::before {
  background: var(--box-warning);
  box-shadow: var(--glow-warning);
  animation: pulse-glow 2s ease-in-out infinite;
}

.box.checking:hover {
  box-shadow: var(--shadow-xl), var(--glow-warning);
}

.box.checking:hover::after {
  background: linear-gradient(90deg,
    rgba(245, 158, 11, 0.8) 0%,
    rgba(217, 119, 6, 0.8) 100%);
  box-shadow: var(--glow-warning);
}

.box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.website-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--border-light);
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.box.healthy .status-badge {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.box.unhealthy .status-badge {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.box.checking .status-badge {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
  animation: text-glow 2s ease-in-out infinite;
}

.box-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.box-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 8px 0;
  line-height: 1.3;
}

.box-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.last-checked {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.response-time {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.chart-container {
  height: 40px;
  margin: 4px 0;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.chart-container:hover {
  opacity: 1;
}

.response-chart {
  width: 100% !important;
  height: 100% !important;
  border-radius: 4px;
}

.box:hover .chart-container {
  opacity: 1;
}

@keyframes pulse-glow {
  0%, 100% {
    opacity: 1;
    box-shadow: var(--glow-warning);
  }
  50% {
    opacity: 0.6;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.6);
  }
}

@keyframes loading-shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.loading-shimmer {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  background-size: 200px 100%;
  animation: loading-shimmer 1.5s infinite;
}

/* Additional glow enhancements */

.auto-refresh-indicator:hover .auto-refresh-dot {
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.6);
}

/* Enhanced interactive states */
.box:active {
  transform: translateY(1px) scale(0.98);
}

.refresh-button:active,
.theme-toggle:active {
  transform: translateY(1px) scale(0.95);
}

/* Subtle floating animation for background elements */
@keyframes float-gentle {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(1deg); }
}

.background-gradient::before {
  animation: float-gentle 20s ease-in-out infinite;
}

/* Text glow animation for status badges */
@keyframes text-glow {
  0%, 100% {
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
  }
  50% {
    text-shadow: 0 0 15px rgba(245, 158, 11, 0.6);
  }
}

/* Enhanced focus states for accessibility */
.box:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  box-shadow: var(--shadow-xl), 0 0 20px rgba(59, 130, 246, 0.3);
}

.refresh-button:focus-visible,
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.refresh-button, .theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  outline: none;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.refresh-button::before,
.theme-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.refresh-button:hover::before,
.theme-toggle:hover::before {
  left: 100%;
}

.refresh-button {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 10px;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  backdrop-filter: blur(10px);
  gap: 0;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.refresh-button:hover {
  background: var(--button-secondary);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg), 0 0 15px rgba(34, 197, 94, 0.3);
}

.refresh-button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.theme-toggle {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  backdrop-filter: blur(10px);
}

.theme-toggle:hover {
  background: var(--button-theme);
  color: white;
  border-color: transparent;
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-lg), var(--glow-theme), 0 0 15px rgba(168, 85, 247, 0.4);
}

.theme-toggle:active {
  transform: translateY(0) scale(1);
  box-shadow: var(--shadow-sm);
}

.theme-icon {
  font-size: 16px;
  transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
  transform: rotate(15deg);
}

.pause-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 8px;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  border: 1px solid var(--border-light);
}

.pause-button:hover {
  background: var(--button-secondary);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg), 0 0 15px rgba(245, 158, 11, 0.3);
}

.pause-button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.pause-button.paused {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.2);
}

.pause-button.paused:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #dc2626;
  box-shadow: var(--shadow-lg), 0 0 15px rgba(239, 68, 68, 0.4);
}

.pause-icon {
  font-size: 14px;
  transition: transform 0.3s ease;
}

.refresh-icon {
  font-size: 16px;
  transition: transform 0.3s ease;
}

.refresh-button:hover .refresh-icon {
  transform: rotate(180deg);
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .title {
    text-align: center;
  }

  .controls {
    justify-content: center;
  }

  .container {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .box {
    min-height: 100px;
    padding: 16px;
  }

  .website-name {
    font-size: 15px;
  }

  .box-text {
    font-size: 13px;
  }

  .chart-container {
    height: 35px;
  }
}

@media (max-width: 480px) {
  .main-wrapper {
    padding: 0 16px;
  }

  .header {
    padding: 12px 0;
    margin-bottom: 24px;
  }

  .title {
    font-size: 1.25rem;
  }

  .controls {
    flex-direction: column;
    gap: 8px;
  }

  .auto-refresh-indicator {
    font-size: 11px;
    padding: 4px 8px;
  }

  .refresh-button {
    width: 36px;
    height: 36px;
    padding: 8px;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
    padding: 8px;
  }

  .chart-container {
    height: 30px;
  }
}

@media (min-width: 1200px) {
  .container {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}
