/* InterView Client Styles - AMOLED Black Premium Aesthetic */
:root {
  --bg-primary: #000000;
  --bg-secondary: #0f0f0f;
  --bg-tertiary: #1a1a1a;
  --surface: #111111;
  --surface-elevated: #1c1c1c;
  --surface-hover: #252525;
  --text-primary: #ffffff;
  --text-secondary: #a1a1a1;
  --text-muted: #666666;
  --text-disabled: #404040;
  --border: #2a2a2a;
  --border-light: #3a3a3a;
  --border-focus: #555555;
  --accent: #ffffff;
  --accent-soft: #f5f5f5;
  --error: #ff6b6b;
  --success: #51cf66;
  --warning: #ffd43b;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.6);
  --titlebar-height: 38px;
  --panel-width: 350px;
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(100, 100, 100, 0.4);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(130, 130, 130, 0.6);
}

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  position: relative;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* Custom Title Bar */
.title-bar {
  height: var(--titlebar-height);
  background: var(--bg-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
  -webkit-app-region: drag;
  border-bottom: 1px solid var(--border);
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  user-select: none;
}

.title-bar-left {
  display: flex;
  align-items: center;
  padding-left: 5px;
}

.title-bar-icon {
  width: 16px;
  height: 16px;
  opacity: 0.9;
}

.title-bar-controls {
  display: flex;
  -webkit-app-region: no-drag;
}

.title-bar-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  border-radius: 4px;
  margin-left: 4px;
}

.title-bar-btn svg {
  width: 10px;
  height: 10px;
}

.title-bar-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.title-bar-btn.close:hover {
  background: #e81123;
  color: white;
}

/* Initial Layout - Code Entry */
.code-entry-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  transition: var(--transition);
  position: relative;
  z-index: 10;
}

.code-entry-container.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

.code-entry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-elevated);
  transition: var(--transition);
}

.code-entry-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  opacity: 0.9;
}

.title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.5;
}

/* Code Input Styles */
.code-input-container {
  margin-bottom: 32px;
}

.code-input-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}

.code-input {
  width: 56px;
  height: 64px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  transition: var(--transition);
  outline: none;
  font-family: "Inter", monospace;
}

.code-input:focus {
  border-color: var(--accent);
  background: var(--surface-elevated);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.code-input.filled {
  border-color: var(--accent);
  background: var(--surface-elevated);
}

.paste-hint {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
}

.submit-btn {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: 12px;
  padding: 16px 48px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-width: 180px;
  position: relative;
  overflow: hidden;
}

.submit-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.submit-btn:disabled {
  background: var(--text-disabled);
  cursor: not-allowed;
  transform: none;
}

.submit-btn:active {
  transform: translateY(0);
}

/* Main Dashboard Layout */
.dashboard-container {
  display: none;
  height: calc(100vh - var(--titlebar-height));
  width: 100vw;
  flex-direction: column;
  opacity: 0;
  transition: var(--transition);
  position: absolute;
  top: var(--titlebar-height);
  left: 0;
  z-index: 5;
}

.dashboard-container.visible {
  display: flex;
  opacity: 1;
}

.dashboard-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  flex-shrink: 0;
}

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

.header-logo {
  width: 20px;
  height: 20px;
  opacity: 0.9;
}

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

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition);
}

.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 10px rgba(81, 207, 102, 0.4);
}

.code-display {
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-tertiary);
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  letter-spacing: 1.5px;
  color: var(--text-primary);
}

.toggle-logs-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.toggle-logs-btn svg {
  width: 14px;
  height: 14px;
}

.toggle-logs-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.disconnect-btn {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.disconnect-btn:hover {
  background: rgba(255, 107, 107, 0.1);
  border-color: var(--error);
}

/* Initial Layout - Code Entry */
.code-entry-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  transition: var(--transition);
  position: relative;
  z-index: 10;
}

.code-entry-container.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

.code-entry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-elevated);
  transition: var(--transition);
}

.code-entry-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  opacity: 0.9;
}

.title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.5;
}

/* Code Input Styles */
.code-input-container {
  margin-bottom: 32px;
}

.code-input-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}

.code-input {
  width: 56px;
  height: 64px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  transition: var(--transition);
  outline: none;
  font-family: "Inter", monospace;
}

.code-input:focus {
  border-color: var(--accent);
  background: var(--surface-elevated);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.code-input.filled {
  border-color: var(--accent);
  background: var(--surface-elevated);
}

.paste-hint {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
}

.submit-btn {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: 12px;
  padding: 16px 48px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-width: 180px;
  position: relative;
  overflow: hidden;
}

.submit-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.submit-btn:disabled {
  background: var(--text-disabled);
  cursor: not-allowed;
  transform: none;
}

.submit-btn:active {
  transform: translateY(0);
}

/* Main Dashboard Layout */
.dashboard-container {
  display: none;
  height: calc(100vh - var(--titlebar-height));
  width: 100vw;
  flex-direction: column;
  opacity: 0;
  transition: var(--transition);
  position: absolute;
  top: var(--titlebar-height);
  left: 0;
  z-index: 5;
}

.dashboard-container.visible {
  display: flex;
  opacity: 1;
}

.dashboard-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  flex-shrink: 0;
}

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

.header-logo {
  width: 20px;
  height: 20px;
  opacity: 0.9;
}

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

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition);
}

.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 10px rgba(81, 207, 102, 0.4);
}

.code-display {
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-tertiary);
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  letter-spacing: 1.5px;
  color: var(--text-primary);
}

.toggle-logs-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.toggle-logs-btn svg {
  width: 14px;
  height: 14px;
}

.toggle-logs-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.disconnect-btn {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.disconnect-btn:hover {
  background: rgba(255, 107, 107, 0.1);
  border-color: var(--error);
}

/* Dashboard Content */
.dashboard-content {
  flex: 1;
  overflow: hidden;
  padding: 12px;
  height: calc(
    100vh - var(--titlebar-height) - 50px
  ); /* Adjusted for new header height */
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 230px 1fr; /* Reduced width for stats column */
  gap: 12px;
  height: 100%;
  max-height: 100%;
}

/* Stats Section */
.stats-section {
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 100%;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: var(--text-primary);
}

.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Monitor Preview Section */
.monitor-preview-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.preview-container {
  flex: 1;
  padding: 12px;
  overflow: auto;
  height: calc(100% - 40px); /* Adjusted for new header height */
}

/* Sliding Log Panel */
.logs-panel {
  position: fixed;
  top: var(--titlebar-height);
  right: -350px;
  width: var(--panel-width);
  height: calc(100vh - var(--titlebar-height));
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

.logs-panel.visible {
  right: 0;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
}

.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.logs-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.close-logs-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: var(--transition);
}

.close-logs-btn svg {
  width: 18px;
  height: 18px;
}

.close-logs-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.logs-content {
  flex: 1;
  overflow: auto;
  padding: 16px;
}

/* Monitor List */
.monitor-list {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(450px, 1fr)
  ); /* Reduced minimum width */
  gap: 14px;
  height: 100%;
}

.monitor-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  min-height: 320px; /* Reduced size */
  background: var(--surface);
  border: 1px solid var(--border);
  transition: var(--transition);
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 9;
}

.monitor-item:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
}

.monitor-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom right,
    var(--bg-tertiary),
    var(--surface)
  );
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.monitor-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Better visibility of monitor content */
  border-radius: 8px;
}

.monitor-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.7) 0%,
    rgba(0, 0, 0, 0) 100%
  );
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  z-index: 1;
}

.monitor-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  padding: 12px;
  backdrop-filter: blur(10px);
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.monitor-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.monitor-resolution {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.monitor-details {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.monitor-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.monitor-badge.external {
  background: rgba(66, 135, 245, 0.3);
  color: #7cb1ff;
  border: 1px solid rgba(66, 135, 245, 0.3);
}

.monitor-badge.internal {
  background: rgba(255, 171, 64, 0.3);
  color: #ffbe6a;
  border: 1px solid rgba(255, 171, 64, 0.3);
}

.monitor-badge.primary {
  background: rgba(75, 202, 129, 0.3);
  color: #85d9a6;
  border: 1px solid rgba(75, 202, 129, 0.3);
}

/* Status Pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.status-pill.streaming {
  background: rgba(81, 207, 102, 0.2);
  color: var(--success);
  border: 1px solid rgba(81, 207, 102, 0.3);
}

.status-pill.inactive {
  background: rgba(161, 161, 161, 0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(161, 161, 161, 0.25);
}

/* Log Container */
.log-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 13px;
  line-height: 1.5;
  max-height: 100%;
  overflow-y: auto;
}

.log-entry {
  position: relative;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border-left: 4px solid var(--border);
  transition: var(--transition);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
    transform: translateY(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.log-entry:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.log-entry.info {
  border-left-color: var(--text-secondary);
}

.log-entry.success {
  border-left-color: var(--success);
  background: rgba(81, 207, 102, 0.07);
}

.log-entry.error {
  border-left-color: var(--error);
  background: rgba(255, 107, 107, 0.07);
}

.log-entry.warning {
  border-left-color: var(--warning);
  background: rgba(255, 212, 59, 0.07);
}

.log-timestamp {
  display: block;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 500;
}

.log-message {
  color: var(--text-primary);
  display: block;
  word-break: break-word;
}
