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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #1a1a1a;
  color: #e0e0e0;
  overflow: hidden;
}

#app {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* Login Screen */
#login-screen {
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

.login-container {
  background: #2d2d2d;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 400px;
}

.login-container h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #4a90e2;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #b0b0b0;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #444;
  border-radius: 4px;
  background: #1a1a1a;
  color: #e0e0e0;
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: #4a90e2;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary {
  background: #4a90e2;
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: #357abd;
}

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

.btn-secondary:hover {
  background: #666;
}

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

.btn-danger:hover {
  background: #c0392b;
}

.error-message {
  color: #e74c3c;
  margin-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
  min-height: 1.2rem;
}

/* Session Screen */
#session-screen {
  padding: 1rem;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.header h2 {
  color: #4a90e2;
}

.session-list {
  flex: 1;
  overflow-y: auto;
}

.session-item {
  background: #2d2d2d;
  padding: 1rem;
  margin-bottom: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.session-item:hover {
  background: #3d3d3d;
}

.session-info h3 {
  margin-bottom: 0.25rem;
  color: #e0e0e0;
}

.session-info p {
  font-size: 0.85rem;
  color: #888;
}

.session-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2ecc71;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: #888;
}

/* Viewer Screen */
#viewer-screen {
  background: #000;
}

.viewer-header {
  background: #2d2d2d;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #444;
}

.device-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#device-name {
  font-weight: 600;
  font-size: 1.1rem;
}

.status-badge {
  background: #2ecc71;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

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

.quality-select {
  padding: 0.5rem;
  background: #1a1a1a;
  color: #e0e0e0;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
}

.canvas-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

#video-canvas {
  max-width: 100%;
  max-height: 100%;
  background: #000;
}

.stream-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 1.2rem;
  color: #888;
}

.stream-status.hidden {
  display: none;
}

.viewer-footer {
  background: #2d2d2d;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-around;
  font-size: 0.85rem;
  color: #888;
  border-top: 1px solid #444;
}

/* Fullscreen */
#viewer-screen:fullscreen .viewer-header,
#viewer-screen:fullscreen .viewer-footer {
  display: none;
}

#viewer-screen:fullscreen .canvas-container {
  height: 100vh;
}

/* Responsive */
@media (max-width: 768px) {
  .viewer-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
}
