/* CSS Variables */
:root {
  --primary: #39ff14;
  --primary-dark: #2ecc12;
  --primary-light: #6aff4d;
  --success: #39ff14;
  --success-dark: #2ecc12;
  --danger: #ff003c;
  --danger-dark: #cc0030;
  --warning: #f59e0b;
  
  --bg: #000000;
  --bg-card: #0a0a0a;
  --bg-card-hover: #141414;
  --bg-elevated: #1a1a1a;
  
  --text: #ffffff;
  --text-muted: #a0a0a0;
  --text-dim: #666666;
  
  --border: #333333;
  --border-light: #444444;
  
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* Container */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  text-align: center;
  padding: 30px 0 20px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  color: var(--primary);
}

.logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.logo h1 span {
  color: var(--primary);
}

.tagline {
  color: var(--text-muted);
  font-size: 14px;
}

/* Status Bar */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all 0.3s ease;
}

.status-bar.connecting .status-dot {
  background: var(--warning);
  animation: pulse 1.5s infinite;
}

.status-bar.connected .status-dot {
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.status-bar.error .status-dot {
  background: var(--danger);
}

.status-text {
  font-size: 14px;
  color: var(--text-muted);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.1); }
}

/* Views */
.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

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

/* Main Content */
.main-content {
  flex: 1;
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  text-align: center;
  transition: all 0.3s ease;
}

.create-card {
  cursor: pointer;
}

.create-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon svg {
  width: 30px;
  height: 30px;
  color: white;
}

.card h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
}

/* Join Input */
.join-input-wrapper {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.join-input-wrapper input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  font-family: 'Inter', monospace;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
}

.join-input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.join-input-wrapper input::placeholder {
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-dim);
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

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

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

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

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

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

/* Waiting View */
.waiting-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
}

.room-code-display {
  margin-bottom: 40px;
}

.room-code-display .label {
  display: block;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 12px;
}

.code-box {
  font-size: 48px;
  font-weight: 700;
  font-family: 'Inter', monospace;
  letter-spacing: 8px;
  color: var(--primary);
  background: var(--bg);
  padding: 20px 30px;
  border-radius: var(--radius);
  border: 2px dashed var(--border);
  margin-bottom: 16px;
  display: inline-block;
}

.waiting-animation {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
}

.waiting-animation svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  color: var(--primary);
  z-index: 2;
}

.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  opacity: 0;
  animation: pulseRing 2s infinite;
}

.pulse-ring:nth-child(2) { animation-delay: 0.5s; }
.pulse-ring:nth-child(3) { animation-delay: 1s; }

@keyframes pulseRing {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

.waiting-card p {
  color: var(--text);
  font-size: 16px;
  margin-bottom: 8px;
}

.waiting-card .hint {
  color: var(--text-dim);
  font-size: 14px;
}

/* Transfer View */
.transfer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.connection-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.connected-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.room-info {
  color: var(--text-muted);
  font-size: 14px;
}

.room-info strong {
  color: var(--text);
  font-family: monospace;
}

/* Drop Zone */
.drop-zone {
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 24px;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.drop-zone.drag-over {
  transform: scale(1.01);
}

.drop-icon {
  width: 60px;
  height: 60px;
  color: var(--primary);
  margin-bottom: 16px;
}

.drop-content h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.drop-content p {
  color: var(--text-muted);
  margin-bottom: 12px;
}

.file-types {
  font-size: 12px;
  color: var(--text-dim);
}

/* Transfer Queue */
.transfer-queue {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.transfer-queue h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.queue-list {
  max-height: 300px;
  overflow-y: auto;
}

.empty-queue {
  text-align: center;
  padding: 40px;
  color: var(--text-dim);
}

.empty-queue svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-queue p {
  font-size: 14px;
}

/* Transfer Item */
.transfer-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

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

.transfer-item-icon {
  width: 44px;
  height: 44px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.transfer-item-icon svg {
  width: 22px;
  height: 22px;
  color: var(--primary);
}

.transfer-item-info {
  flex: 1;
  min-width: 0;
}

.transfer-item-name {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.transfer-item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.transfer-item-status {
  display: flex;
  align-items: center;
  gap: 4px;
}

.transfer-item-status.sending { color: var(--primary); }
.transfer-item-status.receiving { color: var(--warning); }
.transfer-item-status.complete { color: var(--success); }
.transfer-item-status.error { color: var(--danger); }

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 2px;
  transition: width 0.2s ease;
}

.progress-bar-fill.complete {
  background: var(--success);
}

.progress-bar-fill.error {
  background: var(--danger);
}

/* Footer */
.footer {
  text-align: center;
  padding: 24px 0;
  margin-top: auto;
}

.footer p {
  color: var(--text-dim);
  font-size: 13px;
}

.footer-main {
  margin-bottom: 12px;
}

.footer-suggestion {
  max-width: 600px;
  margin: 0 auto;
}

.suggestion-form {
  text-align: left;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 16px 16px 12px;
}

.suggestion-form label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.suggestion-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 60px;
  max-height: 160px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  margin-bottom: 10px;
}

.suggestion-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.suggestion-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.suggestion-actions input[type="email"] {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.suggestion-actions input[type="email"]::placeholder {
  color: var(--text-dim);
}

.suggestion-actions input[type="email"]:focus {
  outline: none;
  border-color: var(--primary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 12px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  border: 1px solid var(--border);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* Device Name Bar */
.device-name-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.device-label {
  color: var(--text-muted);
  font-size: 14px;
  white-space: nowrap;
}

.device-name-bar input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
}

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

/* Nearby Devices Section */
.nearby-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.section-header h2 svg {
  color: var(--primary);
}

.nearby-devices-list {
  min-height: 120px;
}

.nearby-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  color: var(--text-muted);
  text-align: center;
}

.nearby-empty svg {
  opacity: 0.5;
  margin-bottom: 12px;
}

.nearby-empty p {
  font-size: 14px;
  margin-bottom: 4px;
}

.nearby-empty .hint {
  font-size: 12px;
  color: var(--text-dim);
}

.nearby-device {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

.nearby-device:last-child {
  margin-bottom: 0;
}

.nearby-device:hover {
  background: var(--bg-elevated);
}

.nearby-device-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nearby-device-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nearby-device-icon svg {
  width: 20px;
  height: 20px;
  color: white;
}

.nearby-device-name {
  font-weight: 500;
  font-size: 15px;
}

.nearby-device-status {
  font-size: 12px;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 4px;
}

.nearby-device-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
}

.btn-connect {
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

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

/* Section Divider */
.section-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--text-dim);
  font-size: 13px;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  animation: modalIn 0.3s ease;
}

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

.modal-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.modal-icon svg {
  width: 30px;
  height: 30px;
  color: white;
}

.modal-content h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.modal-content p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-actions .btn {
  min-width: 100px;
}

.modal-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 16px;
  }
  
  .header {
    padding: 20px 0 16px;
  }
  
  .logo h1 {
    font-size: 24px;
  }
  
  .code-box {
    font-size: 32px;
    letter-spacing: 4px;
    padding: 16px 20px;
  }
  
  .card {
    padding: 24px;
  }
  
  .drop-zone {
    padding: 40px 20px;
  }
  
  .transfer-header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  
  .connection-info {
    flex-direction: column;
    gap: 8px;
  }
  
  .device-name-bar {
    flex-wrap: wrap;
  }
  
  .device-name-bar input {
    flex-basis: 100%;
    order: 3;
    margin-top: 8px;
  }
  
  .section-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  .nearby-device {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  
  .btn-connect {
    width: 100%;
  }
  
  .modal-content {
    margin: 20px;
    padding: 24px;
  }
  
  .modal-actions {
    flex-direction: column;
  }
  
  .modal-actions .btn {
    width: 100%;
  }
}

/* --- Navigation & Documentation Styles --- */

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
}

.logo-icon.sm {
  width: 24px;
  height: 24px;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
}

/* Docs Layout */
.docs-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 0;
}

.docs-content h1 {
  font-size: 32px;
  margin-bottom: 30px;
  color: var(--primary);
}

.docs-section {
  margin-bottom: 40px;
}

.docs-section h2 {
  font-size: 24px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.docs-section p {
  color: var(--text-muted);
  margin-bottom: 16px;
  font-size: 16px;
}

.docs-section ul, 
.docs-section ol {
  margin-left: 20px;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.docs-section li {
  margin-bottom: 8px;
}

.docs-section li strong {
  color: var(--text);
}

/* Features Grid in Docs */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.feature-item {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.feature-item h3 {
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--text);
}

.feature-item p {
  font-size: 14px;
  margin-bottom: 0;
}

/* Code Block */
.code-block {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
  font-family: monospace;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
}
