:root {
  --color-primary: #4F46E5;
  --color-gray-100: #F3F4F6;
  --color-gray-700: #374151;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--color-gray-700);
  background: #fff;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--color-gray-100);
}
.topbar .brand { font-weight: 600; color: var(--color-primary); }
nav a { margin-right: 1rem; text-decoration: none; color: var(--color-gray-700); }
#view { padding: 1rem; }
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 1rem; }
.btn { background: var(--color-primary); color: #fff; border: none; padding: 0.5rem 0.75rem; border-radius: 6px; cursor: pointer; }
.input { width: 100%; padding: 0.5rem; border: 1px solid #e5e7eb; border-radius: 6px; }
.form-group { margin-bottom: 0.75rem; }

/* Dark mode styles */
.dark body { background: #111827; color: #d1d5db; }
.dark .topbar { background: #1f2937; }
.dark nav a { color: #d1d5db; }
.dark .card { background: #1f2937; }
.dark .input { background: #374151; border-color: #4b5563; color: #d1d5db; }

/* WebSocket Real-time update animations */
@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseUpdate {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(33, 150, 243, 0);
  }
}

.realtime-added {
  animation: slideInFromTop 0.3s ease-out;
}

.realtime-updated {
  animation: pulseUpdate 0.6s ease-out;
}

/* WebSocket Connection status indicator */
.ws-status {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  transition: all 0.3s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.ws-status.connected {
  background: #4CAF50;
  color: white;
}

.ws-status.disconnected {
  background: #F44336;
  color: white;
}

.ws-status.connecting {
  background: #FF9800;
  color: white;
}

.ws-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
/* PWA-specific styles */
body.pwa-mode {
    /* Add extra padding for notch/safe areas on phones */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* Install button */
#pwa-install-btn {
    animation: pulse 2s infinite;
}

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

/* Navigation styles */
.top-nav {
    background: var(--card-background);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

.top-nav h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-color);
    font-weight: 600;
}

.back-button {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.95rem;
    transition: opacity 0.2s;
}

.back-button:hover {
    opacity: 0.8;
}

.theme-toggle {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.theme-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Button styles */
.btn-secondary {
    background: var(--card-background);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--background);
    border-color: var(--primary-color);
}

/* Body background */
body {
    background: var(--background);
    color: var(--text-color);
    min-height: 100vh;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* PWA Install Prompt */
.pwa-install-prompt {
    margin: 20px;
    padding: 20px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pwa-prompt-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.pwa-prompt-text {
    font-size: 16px;
    font-weight: 500;
}

.pwa-prompt-buttons {
    display: flex;
    gap: 10px;
}

.pwa-install-button {
    background: white;
    color: var(--primary-color);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
}

.pwa-install-button:hover {
    background: #f3f4f6;
}

.pwa-dismiss-button {
    background: transparent;
    color: white;
    border: 2px solid white;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
}

.pwa-dismiss-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 600px) {
    .pwa-prompt-content {
        flex-direction: column;
        text-align: center;
    }
    
    .pwa-prompt-buttons {
        width: 100%;
    }
    
    .pwa-install-button,
    .pwa-dismiss-button {
        flex: 1;
    }
}