/* Tailwind CSS - Complete styles for Network Connectivity Tester */

/* Base styles */
*, ::before, ::after {
  box-sizing: border-box;
  border-width: 0;
  border-style: solid;
  border-color: #e5e7eb;
}

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-feature-settings: normal;
  font-variation-settings: normal;
}

body {
  margin: 0;
  line-height: inherit;
}

/* Container */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .container { max-width: 640px; }
}

@media (min-width: 768px) {
  .container { max-width: 768px; }
}

@media (min-width: 1024px) {
  .container { max-width: 1024px; }
}

@media (min-width: 1280px) {
  .container { max-width: 1280px; }
}

@media (min-width: 1536px) {
  .container { max-width: 1536px; }
}

/* Spacing */
.mx-auto { margin-left: auto; margin-right: auto; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-1.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.p-2 { padding: 0.5rem; }
.mt-16 { margin-top: 4rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mr-2 { margin-right: 0.5rem; }
.ml-1 { margin-left: 0.25rem; }

/* Space between children */
.space-x-1 > :not([hidden]) ~ :not([hidden]) { margin-left: 0.25rem; }
.space-x-2 > :not([hidden]) ~ :not([hidden]) { margin-left: 0.5rem; }
.space-x-3 > :not([hidden]) ~ :not([hidden]) { margin-left: 0.75rem; }
.space-x-4 > :not([hidden]) ~ :not([hidden]) { margin-left: 1rem; }
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.5rem; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.75rem; }

/* Flexbox */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }

/* Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

/* Text */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.font-mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace; }

/* Colors */
.text-white { color: rgb(255 255 255); }
.text-gray-400 { color: rgb(156 163 175); }
.text-gray-500 { color: rgb(107 114 128); }
.text-gray-600 { color: rgb(75 85 99); }
.text-gray-700 { color: rgb(55 65 81); }
.text-gray-800 { color: rgb(31 41 55); }
.text-blue-100 { color: rgb(219 234 254); }
.text-blue-200 { color: rgb(191 219 254); }
.text-blue-300 { color: rgb(147 197 253); }
.text-blue-600 { color: rgb(37 99 235); }
.text-green-600 { color: rgb(22 163 74); }
.text-orange-600 { color: rgb(234 88 12); }
.text-red-600 { color: rgb(220 38 38); }
.text-purple-600 { color: rgb(147 51 234); }
.text-cyan-600 { color: rgb(8 145 178); }
.text-indigo-600 { color: rgb(79 70 229); }

/* Backgrounds */
.bg-white { background-color: rgb(255 255 255); }
.bg-gray-50 { background-color: rgb(249 250 251); }
.bg-gray-100 { background-color: rgb(243 244 246); }
.bg-blue-100 { background-color: rgb(219 234 254); }
.bg-green-100 { background-color: rgb(220 252 231); }
.bg-orange-100 { background-color: rgb(255 237 213); }
.bg-purple-100 { background-color: rgb(243 232 255); }
.bg-purple-50 { background-color: rgb(250 245 255); }
.bg-cyan-100 { background-color: rgb(207 250 254); }
.bg-indigo-100 { background-color: rgb(224 231 255); }
.bg-black/20 { background-color: rgb(0 0 0 / 0.2); }

/* Button backgrounds */
.bg-purple-600 { background-color: rgb(147 51 234); }
.bg-blue-600 { background-color: rgb(37 99 235); }
.bg-cyan-600 { background-color: rgb(8 145 178); }
.bg-green-600 { background-color: rgb(22 163 74); }
.bg-orange-600 { background-color: rgb(234 88 12); }

/* Gradients */
.bg-gradient-to-br {
  background-image: linear-gradient(to bottom right, var(--tw-gradient-stops));
}
.from-blue-900 {
  --tw-gradient-from: #1e3a8a;
  --tw-gradient-to: rgb(30 58 138 / 0);
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}
.via-purple-900 {
  --tw-gradient-to: rgb(88 28 135 / 0);
  --tw-gradient-stops: var(--tw-gradient-from), #581c87, var(--tw-gradient-to);
}
.to-indigo-900 {
  --tw-gradient-to: #312e81;
}

/* Borders */
.border { border-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-gray-200 { border-color: rgb(229 231 235); }
.border-white/10 { border-color: rgb(255 255 255 / 0.1); }

/* Border radius */
.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }

/* Shadows */
.shadow-lg {
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Positioning */
.fixed { position: fixed; }
.top-0 { top: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.z-50 { z-index: 50; }

/* Sizing */
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-8 { width: 2rem; }
.w-12 { width: 3rem; }
.w-16 { width: 4rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-8 { height: 2rem; }
.h-12 { height: 3rem; }
.h-16 { height: 4rem; }
.w-0.5 { width: 0.125rem; }
.h-0.5 { height: 0.125rem; }
.w-2 { width: 0.5rem; }
.h-2 { height: 0.5rem; }
.min-h-screen { min-height: 100vh; }

/* Display */
.hidden { display: none; }
.block { display: block; }

/* Overflow */
.break-all { word-break: break-all; }

/* Transitions */
.transition-colors {
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

/* Hover states */
.hover:bg-blue-700:hover { background-color: rgb(29 78 216); }
.hover:bg-purple-700:hover { background-color: rgb(126 34 206); }
.hover:bg-cyan-700:hover { background-color: rgb(14 116 144); }
.hover:bg-green-700:hover { background-color: rgb(21 128 61); }
.hover:bg-orange-700:hover { background-color: rgb(194 65 12); }
.hover:bg-indigo-700:hover { background-color: rgb(67 56 202); }
.hover:underline:hover { text-decoration-line: underline; }

/* Backdrop blur */
.backdrop-blur-md { backdrop-filter: blur(12px); }

/* Custom classes */
.card-hover {
  transition: transform 0.2s ease-in-out;
}

.card-hover:hover {
  transform: translateY(-2px);
}

.connection-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.connection-stable {
  background-color: rgb(34 197 94);
  color: white;
  animation: pulse-green 2s infinite;
}

.connection-unstable {
  background-color: rgb(251 146 60);
  color: white;
  animation: pulse-orange 2s infinite;
}

.connection-disconnected {
  background-color: rgb(239 68 68);
  color: white;
  animation: pulse-red 2s infinite;
}

.top-bar {
  transition: all 0.3s ease;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .top-bar {
    padding: 0.5rem 0;
  }
  
  .top-bar .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .top-bar .flex {
    flex-wrap: nowrap;
    gap: 0.5rem;
  }
  
  .top-bar .space-x-4 > * + * {
    margin-left: 0.5rem;
  }
  
  .top-bar .space-x-3 > * + * {
    margin-left: 0.25rem;
  }
  
  .top-bar .space-x-2 > * + * {
    margin-left: 0.25rem;
  }
  
  .top-bar .space-x-1 > * + * {
    margin-left: 0.125rem;
  }
}

/* Desktop enhancements */
@media (min-width: 769px) {
  .top-bar {
    padding: 0.75rem 0;
  }
  
  .top-bar .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Ensure proper spacing between top-bar and content */
.main-content {
  margin-top: 4rem; /* 64px - mobile */
}

@media (min-width: 768px) {
  .main-content {
    margin-top: 5rem; /* 80px - desktop */
  }
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes pulse-orange {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Timeline Styles */
.timeline-bar {
  width: 3px;
  height: 20px;
  border-radius: 1.5px;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  z-index: 1;
  opacity: 0.8;
  min-width: 3px;
}

.timeline-bar:hover {
  transform: scaleY(1.4);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
  width: 4px;
  opacity: 1;
}

/* Mobile timeline optimizations */
@media (max-width: 768px) {
  .timeline-bar {
    width: 2px;
    height: 16px;
    min-width: 2px;
  }
  
  .timeline-bar:hover {
    width: 3px;
    height: 20px;
  }
  
  #connectionTimeline {
    gap: 0.125rem;
  }
  
  #connectionTimeline .space-x-1 > * + * {
    margin-left: 0.125rem;
  }
}

/* Desktop timeline enhancements */
@media (min-width: 769px) {
  .timeline-bar {
    width: 3px;
    height: 20px;
  }
  
  .timeline-bar:hover {
    width: 4px;
    height: 24px;
  }
  
  #connectionTimeline {
    gap: 0.25rem;
  }
}

.timeline-bar.stable {
  background-color: rgb(34 197 94);
}

.timeline-bar.unstable {
  background-color: rgb(251 146 60);
}

.timeline-bar.disconnected {
  background-color: rgb(239 68 68);
}

.timeline-bar.connecting {
  background-color: rgb(59 130 246);
}

.timeline-bar.checking {
  background-color: rgb(156 163 175);
  animation: checking-pulse 1.5s ease-in-out infinite;
}

@keyframes checking-pulse {
  0%, 100% { 
    opacity: 0.4;
    transform: scaleY(0.8);
  }
  50% { 
    opacity: 1;
    transform: scaleY(1.2);
  }
}

/* Tooltip Styles */
.timeline-tooltip {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-top: 4px;
}

.timeline-tooltip::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-bottom-color: rgba(0, 0, 0, 0.9);
}

.timeline-bar:hover .timeline-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Ensure tooltips are visible above other content */
.timeline-bar:hover {
  z-index: 10;
}

/* History Details Styles */
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.05);
  border-left: 3px solid;
}

.history-item.stable {
  border-left-color: rgb(34 197 94);
}

.history-item.unstable {
  border-left-color: rgb(251 146 60);
}

.history-item.disconnected {
  border-left-color: rgb(239 68 68);
}

.history-item.connecting {
  border-left-color: rgb(59 130 246);
}

/* Responsive design */
@media (min-width: 768px) {
  .md:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md:block { display: block; }
}

@media (min-width: 1024px) {
  .lg:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}