/* ============================================================================
   DICE P2P - Protocol v0.4 Styles
   ============================================================================ */

:root {
  --primary: #4CAF50;
  --primary-dark: #45a049;
  --secondary: #2196F3;
  --secondary-dark: #1976D2;
  --danger: #f44336;
  --danger-dark: #da190b;
  --gray-100: #f5f5f5;
  --gray-200: #eeeeee;
  --gray-300: #e0e0e0;
  --gray-400: #bdbdbd;
  --gray-600: #757575;
  --gray-800: #424242;
  --gray-900: #212121;
  --border-radius: 8px;
  --spacing: 1rem;
}

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

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: var(--gray-900);
  line-height: 1.6;
}

/* ============================================================================
   LAYOUT
   ============================================================================ */

#app {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing);
}

.screen {
  display: none;
  width: 100%;
  max-width: 800px;
  animation: fadeIn 0.3s ease-in;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.container {
  background: white;
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gray-900);
  text-align: center;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 1.5rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.75rem;
}

.subtitle {
  text-align: center;
  color: var(--gray-600);
  margin-bottom: 2rem;
}

/* ============================================================================
   ROLE SELECTION
   ============================================================================ */

.role-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
}

.role-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
  background: var(--gray-100);
  border: 2px solid var(--gray-300);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
}

.role-btn:hover {
  background: var(--gray-200);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.role-icon {
  font-size: 3rem;
}

.role-label {
  font-weight: 600;
  color: var(--gray-800);
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

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

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--secondary-dark);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-dark);
}

.btn-link {
  background: transparent;
  color: var(--secondary);
  padding: 0.5rem 1rem;
}

.btn-link:hover {
  background: var(--gray-100);
}

/* ============================================================================
   STATUS CARD
   ============================================================================ */

.status-card {
  background: var(--gray-100);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.status-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray-300);
}

.status-row:last-child {
  border-bottom: none;
}

.status-row .label {
  font-weight: 600;
  color: var(--gray-600);
}

.status-row .value {
  color: var(--gray-900);
}

.status-row .value.code {
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.2em;
}

/* ============================================================================
   CONTROLS
   ============================================================================ */

.controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

/* ============================================================================
   SECTIONS
   ============================================================================ */

.section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--gray-200);
}

.section:first-of-type {
  margin-top: 1.5rem;
}

.empty-state {
  color: var(--gray-600);
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

/* ============================================================================
   QUEUES & LISTS
   ============================================================================ */

.queue, .list {
  background: var(--gray-100);
  border-radius: var(--border-radius);
  padding: 1rem;
  min-height: 60px;
}

.approval-item, .client-item {
  background: white;
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.approval-item:last-child, .client-item:last-child {
  margin-bottom: 0;
}

.approval-info, .client-info {
  flex: 1;
}

.approval-info .username, .client-info .username {
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.approval-info .path, .client-info .status {
  font-size: 0.875rem;
  color: var(--gray-600);
}

/* Seat-specific styling */
.seat-number {
  color: var(--secondary);
  font-weight: 700;
}

.client-info .status.connected {
  color: var(--primary);
}

.client-info .status.disconnected {
  color: var(--gray-600);
}

.status-icon {
  font-weight: bold;
  margin-right: 0.25rem;
}

.approval-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-approve, .btn-reject {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-approve {
  background: var(--primary);
  color: white;
}

.btn-reject {
  background: var(--danger);
  color: white;
}

/* ============================================================================
   JOIN OPTIONS
   ============================================================================ */

.join-options {
  margin: 2rem 0;
}

.join-method {
  margin-bottom: 2rem;
}

.join-method h3 {
  margin-bottom: 0.5rem;
}

.join-method p {
  color: var(--gray-600);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.input-group {
  display: flex;
  gap: 0.75rem;
}

.input-group input {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid var(--gray-300);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.divider {
  text-align: center;
  margin: 2rem 0;
  position: relative;
}

.divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gray-300);
}

.divider span {
  position: relative;
  background: white;
  padding: 0 1rem;
  color: var(--gray-600);
  font-weight: 600;
  font-size: 0.875rem;
}

/* ============================================================================
   USERNAME INPUT
   ============================================================================ */

.username-input {
  background: var(--gray-100);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin: 2rem 0;
}

/* ============================================================================
   APPROVAL STATES
   ============================================================================ */

.approval-waiting {
  text-align: center;
  padding: 3rem 2rem;
}

.spinner {
  width: 50px;
  height: 50px;
  margin: 0 auto 1rem;
  border: 4px solid var(--gray-300);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.approved-state {
  text-align: center;
  padding: 3rem 2rem;
}

.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: bold;
}

/* ============================================================================
   LOGS
   ============================================================================ */

.logs {
  background: var(--gray-900);
  color: #00ff00;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  padding: 1rem;
  border-radius: var(--border-radius);
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.4;
}

.log-entry {
  margin-bottom: 0.25rem;
  word-wrap: break-word;
}

.log-entry.error {
  color: #ff6b6b;
}

.log-entry.success {
  color: #51cf66;
}

.log-entry.info {
  color: #74c0fc;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 600px) {
  .container {
    padding: 1.5rem;
  }

  h1 {
    font-size: 2rem;
  }

  .role-buttons {
    grid-template-columns: 1fr;
  }

  .controls {
    flex-direction: column;
  }

  .controls .btn {
    width: 100%;
  }

  .input-group {
    flex-direction: column;
  }

  .input-group .btn {
    width: 100%;
  }

  .approval-item, .client-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .approval-actions {
    width: 100%;
  }

  .approval-actions .btn {
    flex: 1;
  }
}
