/* Modern CSS reset and variables */
:root {
  --font-title: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Premium HSL Color Palette */
  --bg-app: hsl(224, 71%, 4%);
  --bg-gradient: linear-gradient(135deg, hsl(224, 71%, 4%) 0%, hsl(222, 47%, 11%) 100%);
  --panel-bg: hsla(223, 47%, 11%, 0.65);
  --panel-border: hsla(217, 30%, 60%, 0.12);
  --panel-glow: 0 12px 40px -10px hsla(224, 80%, 2%, 0.6);
  
  --color-text-primary: hsl(210, 40%, 96%);
  --color-text-secondary: hsl(215, 20%, 65%);
  --color-text-muted: hsl(215, 12%, 40%);
  
  --accent-primary: hsl(250, 84%, 67%);
  --accent-primary-hover: hsl(250, 95%, 72%);
  --accent-primary-glow: hsla(250, 84%, 67%, 0.3);

  --accent-secondary: hsl(210, 100%, 50%);
  --accent-secondary-glow: hsla(210, 100%, 50%, 0.25);
  
  --color-success: hsl(142, 70%, 45%);
  --color-success-glow: hsla(142, 70%, 45%, 0.3);
  --color-danger: hsl(350, 70%, 50%);
  --color-danger-hover: hsl(350, 85%, 55%);
  --color-danger-glow: hsla(350, 70%, 50%, 0.3);
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  background: var(--bg-gradient);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  width: 100%;
  max-width: 1440px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 20px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  box-shadow: var(--panel-glow);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.company-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  box-shadow: 0 0 15px var(--accent-primary-glow);
  position: relative;
  overflow: hidden;
}

.logo-icon::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 45%, rgba(255,255,255,0.3) 50%, transparent 55%);
  animation: shine 4s infinite linear;
}

@keyframes shine {
  0% { transform: translate(-30%, -30%) rotate(0deg); }
  100% { transform: translate(30%, 30%) rotate(360deg); }
}

.logo-area h1 {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-area h1 span {
  color: var(--accent-primary);
  font-weight: 400;
  font-size: 14px;
  background: hsla(250, 84%, 67%, 0.15);
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 6px;
  border: 1px solid hsla(250, 84%, 67%, 0.2);
}

.status-badge-container {
  display: flex;
  align-items: center;
}

.status-badge {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: var(--transition-smooth);
}

.status-badge.disconnected {
  background: hsla(350, 70%, 50%, 0.15);
  color: var(--color-danger);
  border: 1px solid hsla(350, 70%, 50%, 0.3);
}

.status-badge.connecting {
  background: hsla(210, 100%, 50%, 0.15);
  color: var(--accent-secondary);
  border: 1px solid hsla(210, 100%, 50%, 0.3);
  animation: pulse 1.5s infinite ease-in-out;
}

.status-badge.connected {
  background: hsla(142, 70%, 45%, 0.15);
  color: var(--color-success);
  border: 1px solid hsla(142, 70%, 45%, 0.3);
}

@keyframes pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 0.4; }
}

/* Layout */
.app-main {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  flex: 1;
}

@media (max-width: 900px) {
  .app-main {
    grid-template-columns: 1fr;
  }
}

/* Panels */
.panel {
  background: var(--panel-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-glow);
  padding: 28px;
  display: flex;
  flex-direction: column;
}

.panel-header {
  margin-bottom: 24px;
}

.panel-header h2 {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
}

.panel-header p {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-secondary);
}

.input-wrapper {
  display: flex;
  gap: 8px;
}

input[type="text"], input[type="number"] {
  flex: 1;
  background: hsla(222, 47%, 6%, 0.5);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: var(--transition-smooth);
}

input[type="text"]:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary-glow);
}

/* Buttons */
.primary-btn, .secondary-btn, .danger-btn, .control-btn {
  font-family: var(--font-title);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
}

.primary-btn {
  width: 100%;
  background: var(--accent-primary);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 15px;
  box-shadow: 0 4px 15px var(--accent-primary-glow);
  margin-top: 10px;
}

.primary-btn:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px hsla(250, 84%, 67%, 0.45);
}

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

.secondary-btn {
  background: hsla(217, 30%, 60%, 0.15);
  color: var(--color-text-primary);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  font-size: 13px;
  border: 1px solid var(--panel-border);
}

.secondary-btn:hover {
  background: hsla(217, 30%, 60%, 0.25);
  border-color: var(--color-text-secondary);
}

.danger-btn {
  width: 100%;
  background: var(--color-danger);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 15px;
  box-shadow: 0 4px 15px var(--color-danger-glow);
  margin-top: 10px;
}

.danger-btn:hover {
  background: var(--color-danger-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px hsla(350, 70%, 50%, 0.45);
}

/* Session Info Card */
.session-info-card {
  margin-top: 24px;
  padding: 20px;
  background: hsla(250, 84%, 67%, 0.05);
  border: 1px solid hsla(250, 84%, 67%, 0.15);
  border-radius: var(--radius-md);
  animation: fadeIn 0.4s ease-out;
}

.session-info-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--color-text-primary);
  text-align: center;
}

.credential-display {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.cred-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: hsla(222, 47%, 6%, 0.7);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
}

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

.cred-value {
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.cred-value.highlight {
  color: var(--accent-primary);
  font-size: 20px;
  text-shadow: 0 0 10px var(--accent-primary-glow);
}

.cred-value.highlight-domain {
  color: var(--accent-secondary);
  font-size: 13px;
  word-break: break-all;
  text-align: right;
  max-width: 170px;
}

.connection-tip {
  font-size: 11px;
  color: var(--color-text-secondary);
  text-align: center;
  line-height: 1.4;
}

/* Video Feed Area */
.video-panel {
  padding: 0;
  overflow: hidden;
  position: relative;
  background: #000;
}

.video-container {
  width: 100%;
  height: 100%;
  min-height: 480px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#remote-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  z-index: 1;
}

.video-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  z-index: 2;
  background: radial-gradient(circle at center, hsla(223, 47%, 11%, 0.8) 0%, #000 100%);
  transition: opacity 0.5s ease;
}

.placeholder-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: hsla(220, 12%, 40%, 0.2);
  border: 1px solid var(--panel-border);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.placeholder-icon::before {
  content: '';
  width: 24px;
  height: 18px;
  background: var(--color-text-muted);
  border-radius: 4px;
}

.placeholder-icon::after {
  content: '';
  width: 8px;
  height: 8px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid var(--color-text-muted);
  position: absolute;
  right: 18px;
}

.video-placeholder p {
  font-family: var(--font-title);
  color: var(--color-text-secondary);
  font-size: 15px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.pulse-ring {
  width: 80px;
  height: 80px;
  border: 2px solid var(--accent-primary);
  border-radius: 50%;
  position: absolute;
  animation: ring-pulse 1.8s infinite ease-out;
  opacity: 0;
}

@keyframes ring-pulse {
  0% { transform: scale(0.6); opacity: 0; }
  50% { opacity: 0.5; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* Video Overlays */
.video-overlay {
  position: absolute;
  z-index: 10;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  pointer-events: none;
}

.video-overlay.top {
  top: 0;
  left: 0;
}

.video-overlay.bottom {
  bottom: 0;
  left: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
  pointer-events: auto;
}

.video-overlay.bottom button,
.video-overlay.bottom input,
.video-overlay.bottom #tooltip-input-container {
  pointer-events: auto;
}

.stream-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.stream-badge.live {
  background: var(--color-danger);
  color: #fff;
  animation: blink 1.2s infinite ease-in-out;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.stream-timer {
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.seeker-device-info {
  font-family: var(--font-title);
  font-weight: 500;
  font-size: 14px;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.stream-controls {
  display: flex;
  gap: 12px;
}

.control-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.08);
}

.control-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

.control-btn.muted {
  background: var(--color-danger);
  box-shadow: 0 4px 10px var(--color-danger-glow);
}

.control-btn.muted:hover {
  background: var(--color-danger-hover);
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 10px;
  font-size: 12px;
  color: var(--color-text-muted);
}

/* Utilities */
.hidden {
  display: none !important;
}

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

/* Sidebar and Doc Layout updates */
.app-main {
  transition: grid-template-columns 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.app-main.has-doc {
  grid-template-columns: 360px 1fr 1.2fr;
}

.app-main.collapsed-sidebar {
  grid-template-columns: 60px 1fr;
}

.app-main.collapsed-sidebar.has-doc {
  grid-template-columns: 60px 1fr 1.2fr;
}

.app-main.has-doc.collapsed-doc {
  grid-template-columns: 360px 1fr 60px;
}

.app-main.collapsed-sidebar.has-doc.collapsed-doc {
  grid-template-columns: 60px 1fr 60px;
}

.session-panel {
  position: relative;
  transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), padding 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: visible;
}

/* Collapsible toggle button */
.sidebar-toggle-btn {
  position: absolute;
  top: 24px;
  right: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 1px solid var(--panel-border);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px var(--accent-primary-glow);
  z-index: 10;
  transition: var(--transition-smooth);
}

.sidebar-toggle-btn:hover {
  background: var(--accent-primary-hover);
  transform: scale(1.1);
}

.toggle-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.4s ease;
}

/* Collapsed state styles */
.session-panel.collapsed {
  padding: 24px 10px;
}

.session-panel.collapsed .sidebar-content {
  display: none !important;
}

.session-panel.collapsed .toggle-icon {
  transform: rotate(180deg);
}

.session-panel.collapsed .sidebar-toggle-btn {
  right: 16px; /* center it inside the narrow 60px sidebar */
}

/* Document tabs and panel */
.doc-panel {
  animation: fadeIn 0.4s ease-out;
}

.tab-btn {
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  background: hsla(217, 30%, 60%, 0.12) !important;
  color: var(--color-text-primary) !important;
}

.tab-btn.active {
  background: var(--accent-primary) !important;
  color: #fff !important;
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 10px var(--accent-primary-glow);
}

.pdf-iframe {
  width: 100%;
  height: 100%;
  background: #fff;
}

/* Right-side Document toggle button */
.doc-panel {
  position: relative;
  transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), padding 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: visible;
}

.doc-toggle-btn {
  position: absolute;
  top: 24px;
  left: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 1px solid var(--panel-border);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px var(--accent-primary-glow);
  z-index: 10;
  transition: var(--transition-smooth);
}

.doc-toggle-btn:hover {
  background: var(--accent-primary-hover);
  transform: scale(1.1);
}

.doc-toggle-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.4s ease;
}

/* Collapsed state styles for doc-panel */
.doc-panel.collapsed {
  padding: 24px 10px;
}

.doc-panel.collapsed .doc-content {
  display: none !important;
}

.doc-panel.collapsed .doc-toggle-icon {
  transform: rotate(180deg);
}

.doc-panel.collapsed .doc-toggle-btn {
  left: 16px; /* center it inside the narrow 60px sidebar */
}

/* Header Metadata Info Styles */
.header-metadata {
  display: flex;
  gap: 28px;
  align-items: center;
  justify-content: center;
  margin: 0 40px;
  background: hsla(222, 47%, 6%, 0.4);
  border: 1px solid var(--panel-border);
  padding: 8px 24px;
  border-radius: 30px;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.header-metadata .meta-item {
  white-space: nowrap;
}

.header-metadata .meta-item strong {
  color: var(--color-text-secondary);
  opacity: 0.6;
  font-weight: 500;
  margin-right: 6px;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.header-metadata .meta-item span {
  color: #fff;
  font-weight: 700;
}

/* Session Mode Toggle Switch */
.session-mode-container {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 2px;
  align-items: center;
  transition: all 0.3s ease;
}

.mode-btn {
  background: transparent;
  color: var(--color-text-secondary);
  border: none;
  border-radius: 18px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.mode-btn.active {
  background: var(--accent-primary) !important;
  color: #000 !important;
  box-shadow: 0 2px 8px rgba(0, 229, 255, 0.4);
}

/* Tool Buttons for Annotations */
.drawing-toolbar .tool-btn {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.drawing-toolbar .tool-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.drawing-toolbar .tool-btn.active {
  background: var(--accent-primary) !important;
  color: #000 !important;
}

/* Color Options Dot styling */
.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  box-sizing: border-box;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.color-dot:hover {
  transform: scale(1.2);
}

.color-dot.active {
  border: 2px solid #fff !important;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

/* Recording Status Indicators */
.recording-badge {
  background: #ff3b30;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 11px;
  margin-left: 8px;
}

.rec-dot {
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: rec-blink 1.2s infinite;
}

@keyframes rec-blink {
  0% { opacity: 0.2; }
  50% { opacity: 1; }
  100% { opacity: 0.2; }
}

/* Camera flash animation effect for snapshots */
.flash-effect {
  animation: camera-flash 0.3s ease-out;
}

@keyframes camera-flash {
  0% { filter: brightness(1); }
  50% { filter: brightness(3); }
  100% { filter: brightness(1); }
}

.control-btn.recording {
  background: rgba(255, 59, 48, 0.2) !important;
  color: #ff3b30 !important;
  border-color: #ff3b30 !important;
  animation: rec-pulse 1.5s infinite;
}

@keyframes rec-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(255, 59, 48, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}

/* Audit Spreadsheet Styles */
.audit-panel {
  animation: fadeIn 0.4s ease-out;
}
.audit-panel input[type="text"] {
  background: transparent;
  border: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 0;
  padding: 6px;
  width: 100%;
  color: #fff;
  font-size: 12px;
  transition: all 0.2s ease;
}
.audit-panel input[type="text"]:focus {
  border-bottom-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.03);
  outline: none;
  box-shadow: none;
}
.spreadsheet-container table {
  width: 100%;
  border-collapse: collapse;
}
.spreadsheet-container th {
  color: var(--color-text-secondary);
  font-family: var(--font-title);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
  padding: 10px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--panel-border);
  border-right: 1px solid var(--panel-border);
}
.spreadsheet-container td {
  padding: 4px;
  border-bottom: 1px solid var(--panel-border);
  border-right: 1px solid var(--panel-border);
  vertical-align: middle;
}
.spreadsheet-container tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.spreadsheet-container td:last-child, .spreadsheet-container th:last-child {
  border-right: none;
}
.audit-machine-details input[type="text"] {
  background: hsla(222, 47%, 6%, 0.5);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 8px 12px;
}
.audit-machine-details input[type="text"]:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary-glow);
}
#tooltip-input-container {
  pointer-events: auto !important;
}
#tooltip-input-container input {
  pointer-events: auto !important;
}

