/* ==========================================================================
   Base Styles
   ========================================================================== */

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  margin: 0;
  padding: 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

/* ==========================================================================
   Layout Components
   ========================================================================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.header {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  padding: 2rem;
  text-align: center;
}

.header h1 {
  margin: 0 0 0.5rem 0;
  font-size: 2.5rem;
  font-weight: 300;
}

.header p {
  margin: 0;
  opacity: 0.9;
  font-size: 1.1rem;
}

.device-detection-header {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.device-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 1rem;
}

.device-badge {
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.device-badge.ios-device {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.4);
}

.device-badge.non-ios-device {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}

.controls {
  padding: 1.5rem 2rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.content {
  padding: 2rem;
}

/* ==========================================================================
   Button Components
   ========================================================================== */

.btn {
  background: #4f46e5;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn:hover {
  background: #4338ca;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: #6b7280;
}

.btn-secondary:hover {
  background: #4b5563;
}

.btn-small {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
}

/* ==========================================================================
   Statistics Display
   ========================================================================== */

.stats {
  margin-left: auto;
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
  color: #6b7280;
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-value {
  font-weight: 600;
  color: #374151;
}

/* ==========================================================================
   Table Components
   ========================================================================== */

table {
  border-collapse: collapse;
  width: 100%;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 1rem;
  text-align: left;
  border-bottom: 2px solid #e2e8f0;
}

td {
  padding: 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}

tr:hover {
  background: #f8fafc;
}

/* ==========================================================================
   Test Result Components
   ========================================================================== */

.feature-name {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-weight: 600;
  color: #1e293b;
  font-size: 0.9rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.fail {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.pending {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
}

.running {
  background: #dbeafe;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.details {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.5;
  max-width: 400px;
}

.details a {
  color: #4f46e5;
  text-decoration: none;
}

.details a:hover {
  text-decoration: underline;
}

.test-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.timing {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.error-details {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 0.75rem;
  margin-top: 0.5rem;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.8rem;
  color: #991b1b;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==========================================================================
   Loading Spinner
   ========================================================================== */

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #4f46e5;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { 
    transform: rotate(0deg); 
  }
  100% { 
    transform: rotate(360deg); 
  }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
  body {
    padding: 1rem;
  }
  
  .header h1 {
    font-size: 2rem;
  }
  
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .stats {
    margin-left: 0;
    justify-content: center;
  }
  
  table {
    font-size: 0.85rem;
  }
  
  th, td {
    padding: 0.75rem 0.5rem;
  }
}

/* ==========================================================================
   iOS Detection Styles
   ========================================================================== */

.ios-detection-result {
  font-size: 0.9rem;
  line-height: 1.4;
}

.ios-status {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: 8px;
  border-left: 4px solid #3b82f6;
}

.ios-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

.ios-badge.ios-true {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.ios-badge.ios-false {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.device-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.info-section,
.detection-indicators {
  background: #f9fafb;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

.info-section strong,
.detection-indicators strong {
  display: block;
  margin-bottom: 0.5rem;
  color: #374151;
  font-size: 0.875rem;
}

.info-section ul,
.detection-indicators ul {
  margin: 0;
  padding-left: 1rem;
  list-style: none;
}

.info-section li,
.detection-indicators li {
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  color: #6b7280;
}

.info-section li strong,
.detection-indicators li strong {
  display: inline;
  margin: 0;
  color: #374151;
}

.user-agent {
  background: #f3f4f6;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.75rem;
  word-break: break-all;
  display: block;
  margin-top: 0.25rem;
  border: 1px solid #d1d5db;
}

@media (max-width: 768px) {
  .device-info {
    grid-template-columns: 1fr;
  }
  
  .ios-detection-result {
    font-size: 0.8rem;
  }
  
  .user-agent {
    font-size: 0.7rem;
  }
}