/*! Socket.IO Online Tester Styles */

/* ==========================================================================
   Base styles
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  line-height: 1.6;
}

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

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 40px;
  color: white;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

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

main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 40px;
}

section {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
}

section h2 {
  color: #2d3748;
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 10px;
}

section h3 {
  color: #4a5568;
  font-size: 1.1rem;
  font-weight: 500;
  margin: 15px 0 10px 0;
}

/* ==========================================================================
   Form Components
   ========================================================================== */

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #2d3748;
}

input[type="text"], 
textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: #f7fafc;
}

input[type="text"]:focus, 
textarea:focus {
  outline: none;
  border-color: #667eea;
  background: white;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
  min-height: 80px;
  resize: vertical;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

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

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #718096;
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #4a5568;
  transform: translateY(-2px);
}

.btn-danger {
  background: #e53e3e;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #c53030;
  transform: translateY(-2px);
}

/* ==========================================================================
   Status Components
   ========================================================================== */

.status-indicator {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
}

.status-indicator.connected {
  background: #c6f6d5;
  color: #22543d;
}

.status-indicator.connected::before {
  background: #38a169;
}

.status-indicator.disconnected {
  background: #fed7d7;
  color: #742a2a;
}

.status-indicator.disconnected::before {
  background: #e53e3e;
}

.status-indicator.connecting {
  background: #fefcbf;
  color: #744210;
}

.status-indicator.connecting::before {
  background: #d69e2e;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ==========================================================================
   Connection Controls
   ========================================================================== */

.connection-form {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.connection-form input {
  flex: 1;
  min-width: 250px;
}

/* ==========================================================================
   Listeners Section
   ========================================================================== */

.listener-form {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 25px;
}

.listener-form input {
  flex: 1;
}

#active-listeners {
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 5px;
  background: #f7fafc;
}

.listener-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 8px;
}

.listener-item:last-child {
  margin-bottom: 0;
}

.listener-name {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-weight: 500;
  color: #2d3748;
}

.listener-count {
  background: #667eea;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  margin-right: 10px;
}

.data-type-selector {
  margin-bottom: 8px;
}

.data-type-selector label {
  display: flex;
  align-items: center;
  font-size: 14px;
  cursor: pointer;
}

.data-type-selector input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.1);
}

.socket-id-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: #e2e8f0;
  color: #4a5568;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  border: 1px solid #cbd5e0;
}

#socket-id-value {
  color: #2d3748;
  font-weight: 600;
}

/* ==========================================================================
   Messages Log
   ========================================================================== */

.messages-controls {
  margin-bottom: 20px;
}

.messages-log {
  max-height: 400px;
  overflow-y: auto;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: #1a202c;
  padding: 15px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
  line-height: 1.5;
}

.message-item {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #2d3748;
}

.message-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.message-timestamp {
  color: #a0aec0;
  font-size: 11px;
  margin-bottom: 4px;
}

.message-event {
  color: #63b3ed;
  font-weight: 600;
  margin-bottom: 4px;
}

.message-data {
  color: #68d391;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-system {
  color: #fbb6ce;
}

.message-error {
  color: #fc8181;
}

/* ==========================================================================
   Full-width sections
   ========================================================================== */

.full-width {
  grid-column: 1 / -1;
}

/* ==========================================================================
   Footer
   ========================================================================== */

footer {
  text-align: center;
  padding: 30px 20px;
  color: white;
  margin-top: 40px;
}

footer p {
  font-size: 14px;
  opacity: 0.8;
}

footer a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

footer a:hover {
  opacity: 0.7;
}

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

@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
  
  header h1 {
    font-size: 2rem;
  }
  
  main {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  section {
    padding: 20px;
  }
  
  .connection-form {
    flex-direction: column;
    align-items: stretch;
  }
  
  .connection-form input {
    min-width: auto;
  }
  
  .listener-form {
    flex-direction: column;
    align-items: stretch;
  }
  
  .listener-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
}