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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #333;
  min-height: 100vh;
  padding: 20px;
  transition: background 0.3s, color 0.3s;
}

/* Dark Mode */
body.dark-mode {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #e2e8f0;
}

body.dark-mode header {
  background: #1e293b;
  border: 1px solid #334155;
}

body.dark-mode main {
  background: #1e293b;
  border: 1px solid #334155;
}

body.dark-mode .card {
  background: #0f172a;
  border-color: #334155;
}

body.dark-mode .section h2,
body.dark-mode header h1 {
  color: #818cf8;
}

body.dark-mode .card h3,
body.dark-mode .device-info h4,
body.dark-mode .modal-header h3,
body.dark-mode .source-item p {
  color: #e2e8f0;
}

body.dark-mode .device-info p,
body.dark-mode .help-text,
body.dark-mode .info-item .label {
  color: #94a3b8;
}

body.dark-mode .status-box,
body.dark-mode .device-item,
body.dark-mode .trusted-device-item,
body.dark-mode .source-item {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .modal-content {
  background: #1e293b;
}

body.dark-mode .modal-header {
  border-color: #334155;
}

body.dark-mode .stream-info {
  background: #0f172a;
}

body.dark-mode .pairing-code-display input {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #818cf8;
}

body.dark-mode .input-group input[type="text"],
body.dark-mode .quality-select {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}

body.dark-mode .empty-state {
  color: #64748b;
}

body.dark-mode #connection-text {
  color: #94a3b8;
}

body.dark-mode .info-box {
  background: #1e293b;
  border-left-color: #818cf8;
  color: #e2e8f0;
}

body.dark-mode .info-box strong {
  color: #e2e8f0;
}

body.dark-mode .info-box span {
  color: #94a3b8;
}

body.dark-mode .session-timer {
  background: #0f172a;
  border-color: #334155;
}

body.dark-mode .session-timer .timer-label {
  color: #94a3b8;
}

body.dark-mode #session-timer {
  color: #818cf8;
}

body.dark-mode .history-list {
  color: #e2e8f0;
}

body.dark-mode .history-item {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .history-item h4 {
  color: #818cf8;
}

body.dark-mode .history-item p {
  color: #94a3b8;
}

body.dark-mode .screenshot-notification {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}

body.dark-mode .shortcuts-help {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .shortcuts-help h3 {
  color: #818cf8;
  border-color: #334155;
}

body.dark-mode .shortcuts-help li {
  color: #e2e8f0;
}

body.dark-mode .shortcuts-help kbd {
  background: #0f172a;
  color: #818cf8;
  border-color: #334155;
}

body.dark-mode .app-version {
  background: #1e293b;
  color: #818cf8;
  border-color: #334155;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

header {
  background: white;
  padding: 20px 30px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

header h1 {
  font-size: 28px;
  color: #667eea;
  font-weight: 700;
  margin: 0;
}

.app-version {
  background: #eff6ff;
  color: #667eea;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #dbeafe;
}

.update-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #fef3c7;
  border-radius: 8px;
  font-size: 13px;
  color: #92400e;
  border: 1px solid #fde68a;
}

.update-status.checking {
  background: #dbeafe;
  color: #1e40af;
  border-color: #bfdbfe;
}

.update-status.downloading {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.update-status.ready {
  background: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
}

.update-status.up-to-date {
  background: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
}

.update-icon {
  font-size: 16px;
  animation: spin 2s linear infinite;
}

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

.update-status.ready .update-icon,
.update-status.up-to-date .update-icon {
  animation: none;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.connected {
  background-color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.status-dot.disconnected {
  background-color: #ef4444;
}

#connection-text {
  font-size: 14px;
  font-weight: 500;
  color: #666;
}

main {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  min-height: 500px;
}

.section {
  animation: fadeIn 0.3s ease-in;
}

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

.section h2 {
  color: #667eea;
  margin-bottom: 25px;
  font-size: 24px;
}

.card {
  background: #f9fafb;
  padding: 25px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid #e5e7eb;
}

.card h3 {
  color: #374151;
  margin-bottom: 15px;
  font-size: 18px;
}

.input-group {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.input-group label {
  font-weight: 500;
  color: #374151;
  min-width: 120px;
}

.input-group input[type="text"] {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  min-width: 200px;
}

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

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #5568d3;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

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

.btn-secondary:hover:not(:disabled) {
  background: #4b5563;
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

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

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-large {
  padding: 30px;
  font-size: 16px;
  min-width: 250px;
  flex-direction: column;
}

.btn-large .icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.role-selection {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.info-box {
  background: #eff6ff;
  padding: 15px;
  border-radius: 6px;
  margin-top: 15px;
  border-left: 4px solid #667eea;
}

.pairing-code-display {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.pairing-code-display input {
  flex: 1;
  padding: 15px;
  border: 2px solid #667eea;
  border-radius: 6px;
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  letter-spacing: 5px;
  font-family: monospace;
  background: white;
}

.help-text {
  margin-top: 10px;
  color: #6b7280;
  font-size: 13px;
}

.status-box {
  background: white;
  padding: 20px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  text-align: center;
}

.devices-list {
  margin-top: 15px;
  max-height: 400px;
  overflow-y: auto;
}

.device-item {
  background: white;
  padding: 15px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.device-item:hover {
  border-color: #667eea;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
}

.device-info h4 {
  color: #374151;
  margin-bottom: 5px;
}

.device-info p {
  color: #6b7280;
  font-size: 13px;
}

.device-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.device-status.available {
  background: #d1fae5;
  color: #065f46;
}

.device-status.paired {
  background: #fef3c7;
  color: #92400e;
}

.empty-state {
  text-align: center;
  color: #9ca3af;
  padding: 40px;
  font-size: 14px;
}

.source-preview {
  margin-top: 15px;
  text-align: center;
}

.source-preview img {
  max-width: 300px;
  border-radius: 6px;
  border: 2px solid #d1d5db;
  margin-bottom: 10px;
}

.source-preview p {
  color: #374151;
  font-weight: 500;
}

.streaming-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.streaming-header h2 {
  margin: 0;
}

.streaming-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.quality-select {
  padding: 10px 15px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
}

.quality-select:hover {
  border-color: #667eea;
}

.quality-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.stream-container {
  position: relative;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
  aspect-ratio: 16 / 9;
}

#remote-stream,
#remote-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: none; /* Hide viewer's cursor on stream */
}

.stream-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

.stream-info {
  display: flex;
  gap: 30px;
  padding: 15px;
  background: #f9fafb;
  border-radius: 6px;
  justify-content: center;
}

.info-item {
  display: flex;
  gap: 10px;
}

.info-item .label {
  font-weight: 500;
  color: #6b7280;
}

.info-item span:last-child {
  color: #374151;
  font-weight: 600;
}

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

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px 30px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  color: #374151;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #9ca3af;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.modal-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.modal-body {
  padding: 20px 30px;
  overflow-y: auto;
}

.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
}

.source-item {
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.source-item:hover {
  border-color: #667eea;
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
  transform: translateY(-2px);
}

.source-item img {
  width: 100%;
  border-radius: 4px;
  margin-bottom: 8px;
}

.source-item p {
  font-size: 13px;
  color: #374151;
  font-weight: 500;
  word-break: break-word;
}

/* Stream Settings */
.stream-settings {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.setting-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 200px;
}

.setting-group label {
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}

.setting-group .quality-select {
  flex: 1;
}

/* Trusted Devices */
.trusted-devices-list {
  margin-top: 15px;
  max-height: 300px;
  overflow-y: auto;
}

.trusted-device-item {
  background: white;
  padding: 15px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.trusted-device-item .device-info h4 {
  color: #10b981;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

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

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Session Timer */
.streaming-header-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  width: fit-content;
}

.timer-label {
  color: #6b7280;
  font-weight: 500;
}

#session-timer {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: #667eea;
  font-size: 14px;
}

/* Connection History */
.history-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  justify-content: space-between;
}

.history-list {
  max-height: 500px;
  overflow-y: auto;
}

.history-item {
  background: white;
  padding: 15px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  margin-bottom: 10px;
  transition: all 0.2s;
}

.history-item:hover {
  border-color: #667eea;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
}

.history-item h4 {
  color: #667eea;
  margin-bottom: 8px;
  font-size: 16px;
}

.history-item p {
  color: #6b7280;
  font-size: 13px;
  margin: 4px 0;
}

/* Screenshot Notification */
.screenshot-notification {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: white;
  color: #374151;
  padding: 15px 25px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid #d1d5db;
  font-weight: 500;
  font-size: 14px;
  z-index: 1000;
  animation: slideInUp 0.3s ease-out;
}

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

/* Keyboard Shortcuts Help */
.shortcuts-help {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid #d1d5db;
  z-index: 1000;
  max-width: 350px;
}

.shortcuts-help h3 {
  margin: 0 0 15px 0;
  color: #667eea;
  font-size: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e5e7eb;
}

.shortcuts-help ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.shortcuts-help li {
  padding: 8px 0;
  color: #374151;
  font-size: 14px;
}

.shortcuts-help kbd {
  display: inline-block;
  padding: 2px 6px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: 600;
  color: #667eea;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* File Transfer */
.file-transfer-area {
  padding: 20px;
}

.file-drop-zone {
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: #f9fafb;
}

.file-drop-zone:hover {
  border-color: #667eea;
  background: #eff6ff;
}

.file-drop-zone.dragover {
  border-color: #667eea;
  background: #eff6ff;
  transform: scale(1.02);
}

.file-drop-zone p {
  color: #374151;
  font-size: 16px;
  margin: 0;
}

.file-transfer-progress {
  padding: 20px;
}

.file-transfer-progress p {
  margin: 10px 0;
  color: #374151;
  font-weight: 500;
}

.progress-bar {
  width: 100%;
  height: 30px;
  background: #e5e7eb;
  border-radius: 15px;
  overflow: hidden;
  margin: 15px 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  width: 0%;
  transition: width 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 600;
}

/* Recording Indicator */
.recording-indicator {
  position: fixed;
  top: 80px;
  right: 30px;
  background: #dc2626;
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.recording-dot {
  animation: pulse 1.5s ease-in-out infinite;
}

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

#recording-time {
  font-family: 'Courier New', monospace;
  font-size: 15px;
}

/* Monitor Selection */
.monitor-selection {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.monitor-option {
  flex: 1;
  min-width: 150px;
  padding: 15px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  background: white;
}

.monitor-option:hover {
  border-color: #667eea;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
}

.monitor-option.selected {
  border-color: #667eea;
  background: #eff6ff;
}

.monitor-option h4 {
  color: #374151;
  margin-bottom: 5px;
  font-size: 14px;
}

.monitor-option p {
  color: #6b7280;
  font-size: 12px;
  margin: 0;
}

/* Dark Mode - New Features */
body.dark-mode .file-drop-zone {
  background: #0f172a;
  border-color: #334155;
}

body.dark-mode .file-drop-zone:hover,
body.dark-mode .file-drop-zone.dragover {
  background: #1e293b;
  border-color: #818cf8;
}

body.dark-mode .file-drop-zone p {
  color: #e2e8f0;
}

body.dark-mode .file-transfer-progress p {
  color: #e2e8f0;
}

body.dark-mode .progress-bar {
  background: #1e293b;
}

body.dark-mode .monitor-option {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .monitor-option:hover {
  border-color: #818cf8;
}

body.dark-mode .monitor-option.selected {
  border-color: #818cf8;
  background: #0f172a;
}

body.dark-mode .monitor-option h4 {
  color: #e2e8f0;
}

body.dark-mode .monitor-option p {
  color: #94a3b8;
}