/**
 * URS Matcher Kiosk Styles
 * Design System: Digital Concrete v2.0
 * Version: 2.0.0
 * Date: 2025-12-28
 */

/* ============================================
   DESIGN SYSTEM IMPORT
   ============================================ */
@import url('./design-system/tokens.css');
@import url('./design-system/components.css');

/* ============================================
   LAYOUT
   ============================================ */
.app-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Prevent overflow on all elements */
* {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* Header */
.app-header {
  background: linear-gradient(145deg, var(--panel-clean) 0%, var(--panel-clean-end) 100%);
  color: var(--text-primary);
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
  box-shadow: var(--shadow-panel);
  border-bottom: 1px solid var(--edge-light);
  position: relative;
}

.header-content h1 {
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 var(--space-sm) 0;
  color: var(--text-primary);
  text-shadow: 0 0 20px var(--accent-orange-glow);
}

.header-content h1::before {
  content: '🏗️ ';
  filter: drop-shadow(0 0 10px rgba(255, 159, 28, 0.6));
}

.subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 500;
}

/* Header Controls Container */
.header-controls {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Theme Toggle */
.c-theme-toggle {
  background: linear-gradient(145deg, var(--panel-clean) 0%, var(--panel-clean-end) 100%);
  border: 1px solid var(--edge-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-button);
  padding: 8px 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Model Selector */
.model-selector {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: linear-gradient(145deg, var(--panel-clean) 0%, var(--panel-clean-end) 100%);
  border: 1px solid var(--edge-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-button);
  padding: 6px 12px;
}

.model-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.model-select {
  background: var(--data-surface);
  border: 1px solid var(--edge-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 12px;
  padding: 4px 8px;
  min-width: 140px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.model-select:focus {
  outline: none;
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 2px rgba(255, 159, 28, 0.15);
}

.model-select:hover {
  border-color: var(--accent-orange);
}

.model-select option {
  background: var(--panel-clean);
  color: var(--text-primary);
  padding: 4px 8px;
}

.model-status {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.model-status.free {
  background: rgba(76, 175, 80, 0.15);
  color: #4CAF50;
}

.model-status.cheap {
  background: rgba(33, 150, 243, 0.15);
  color: #2196F3;
}

.model-status.premium {
  background: rgba(255, 159, 28, 0.15);
  color: var(--accent-orange);
}

.model-status.error {
  background: rgba(244, 67, 54, 0.15);
  color: #F44336;
}

.c-theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  color: var(--accent-orange);
}

.c-theme-toggle:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-inset);
}

/* Main Content */
.app-main {
  flex: 1;
  padding: var(--space-2xl) var(--space-lg);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Sections */
.section {
  display: none;
  animation: fadeIn 0.3s ease-in;
}

.section.active {
  display: block;
}

.section.hidden {
  display: none;
}

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

.section-content {
  background: linear-gradient(145deg, var(--panel-clean) 0%, var(--panel-clean-end) 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-panel);
  border-top: 1px solid var(--edge-light);
}

.section-content h2 {
  font-size: 24px;
  margin: 0 0 var(--space-xl) 0;
  color: var(--text-primary);
  font-weight: 600;
}

/* ============================================
   ACTION GRID (Main Upload Section)
   ============================================ */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

.action-card {
  background: var(--data-surface);
  border: 1px solid var(--edge-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-inset);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.action-icon {
  font-size: 48px;
  text-align: center;
  margin-bottom: var(--space-sm);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.action-card h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.action-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

.action-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: var(--space-sm);
}

/* File Upload Area */
.file-upload-area {
  background: var(--panel-clean);
  border: 2px dashed var(--edge-dark);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.file-upload-area:hover {
  border-color: var(--accent-orange);
  background: var(--panel-clean-end);
}

.file-upload-area.drag-over {
  border-color: var(--accent-orange);
  background: var(--panel-clean-end);
  box-shadow: 0 0 20px var(--accent-orange-glow);
}

.upload-text {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

/* Text Input Controls */
.text-input-controls {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-sm);
}

/* Processing Mode Toggle */
.processing-mode {
  margin: var(--space-md) 0;
  padding: var(--space-md);
  background: var(--panel-clean);
  border: 1px solid var(--edge-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-button);
}

.mode-toggle {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  cursor: pointer;
  user-select: none;
}

.mode-toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent-orange);
}

.mode-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.mode-label strong {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.mode-description {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.mode-toggle:hover .mode-label strong {
  color: var(--accent-orange);
  text-shadow: 0 0 10px var(--accent-orange-glow);
  transition: all var(--transition-fast);
}

/* Processing Mode Selector (Radio Buttons) */
.processing-mode-selector {
  margin: var(--space-md) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.mode-option {
  display: block;
  cursor: pointer;
  position: relative;
}

.mode-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.mode-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-md);
  background: var(--panel-clean);
  border: 2px solid var(--edge-light);
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-button);
}

.mode-option input[type="radio"]:checked + .mode-card {
  border-color: var(--accent-orange);
  background: var(--panel-clean-end);
  box-shadow: 0 0 0 3px rgba(255, 159, 28, 0.1),
              var(--shadow-hover);
}

.mode-option:hover .mode-card {
  border-color: var(--accent-orange);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.mode-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.mode-icon {
  font-size: 1.2em;
  flex-shrink: 0;
}

.mode-timing {
  margin-left: auto;
  font-size: 0.85em;
  color: var(--text-muted);
  font-weight: normal;
  background: var(--bg-primary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--edge-light);
}

.mode-card .mode-description {
  color: var(--text-secondary);
  font-size: 0.85em;
  line-height: 1.5;
  margin-left: calc(1.2em + var(--space-sm)); /* Align with text after icon */
}

.mode-option input[type="radio"]:checked + .mode-card .mode-header {
  color: var(--accent-orange);
}

.mode-option input[type="radio"]:checked + .mode-card .mode-timing {
  background: var(--accent-orange);
  color: white;
  border-color: var(--accent-orange);
}

/* ============================================
   BUTTONS (using design system)
   ============================================ */
.btn {
  /* Uses .c-btn from components.css */
  background: linear-gradient(145deg, var(--panel-clean) 0%, var(--panel-clean-end) 100%);
  border: none;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-button);
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 24px;
  transition: all var(--transition-fast);
  border-top: 1px solid var(--edge-light);
  min-height: 44px;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: var(--shadow-inset);
}

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

.btn-primary {
  color: var(--accent-orange);
  font-weight: 600;
  text-shadow: 0 0 15px var(--accent-orange-glow);
}

.btn-primary:hover:not(:disabled) {
  text-shadow:
    0 0 20px var(--accent-orange-glow),
    0 0 35px var(--accent-orange-strong);
}

.btn-secondary {
  color: var(--text-secondary);
}

.btn-success {
  color: var(--status-success);
}

.btn-danger {
  color: var(--status-error);
}

/* Action Buttons Container */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

/* ============================================
   INPUTS (using design system)
   ============================================ */
textarea,
input[type="text"],
input[type="number"],
input[type="file"] {
  background: var(--data-surface);
  border: 1px solid var(--edge-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-inset);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 16px;
  width: 100%;
  min-height: 44px;
  transition: all var(--transition-fast);
  resize: vertical;
}

textarea::placeholder,
input::placeholder {
  color: var(--text-muted);
}

textarea:focus,
input:focus {
  outline: none;
  border-color: var(--accent-orange);
  box-shadow:
    var(--shadow-inset),
    0 0 0 2px rgba(255, 159, 28, 0.15),
    0 0 15px var(--accent-orange-glow);
}

input[type="number"] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ============================================
   RESULTS SECTION
   ============================================ */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}

#resultsTitle {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.results-container {
  background: var(--data-surface);
  border: 1px solid var(--edge-light);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  min-height: 400px;
  box-shadow: var(--shadow-inset);
  overflow-x: auto; /* Allow horizontal scroll for wide content */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Tables (if present in results) */
.results-container table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 600px; /* Minimum width for table readability */
}

.results-container table th,
.results-container table td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--edge-light);
}

.results-container table th {
  background: var(--panel-clean);
  font-weight: 600;
  color: var(--text-primary);
  position: sticky;
  top: 0;
  z-index: 1;
}

.results-container table td {
  color: var(--text-secondary);
}

.results-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Loading State */
.loading {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-secondary);
  font-size: 16px;
}

/* Result Item */
.result-item {
  background: var(--panel-clean);
  border: 1px solid var(--edge-light);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-button);
  transition: all var(--transition-fast);
}

.result-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.result-item h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-sm) 0;
}

.result-item p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.result-code {
  font-family: var(--font-mono);
  color: var(--accent-orange);
  font-weight: 600;
  font-size: 15px;
  text-shadow: 0 0 10px var(--accent-orange-glow);
}

/* ============================================
   INFO PANELS (Phase 3)
   ============================================ */
.info-panel {
  background: var(--data-surface);
  border: 1px solid var(--edge-light);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-inset);
}

.info-panel h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-lg) 0;
}

/* Complexity Grid */
.complexity-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-lg);
}

.complexity-card {
  background: var(--panel-clean);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
}

.complexity-level {
  font-size: 32px;
  font-weight: 700;
  display: block;
  margin-bottom: var(--space-sm);
}

.complexity-details p {
  margin: var(--space-sm) 0;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Roles Grid */
.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
}

.role-card {
  background: var(--panel-clean);
  border: 1px solid var(--edge-light);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  box-shadow: var(--shadow-button);
}

.role-card .role-icon {
  font-size: 32px;
  margin-bottom: var(--space-sm);
}

.role-card .role-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Conflicts List */
.conflicts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.conflict-item {
  background: var(--panel-clean);
  border-left: 4px solid var(--status-warning);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

/* Analysis Results */
.analysis-results {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Audit Trail */
.audit-trail {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--panel-inset);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  max-height: 400px;
  overflow-y: auto;
}

/* ============================================
   ERROR SECTION
   ============================================ */
.error-content {
  text-align: center;
  padding: var(--space-2xl);
}

.error-content h2 {
  color: var(--status-error);
  font-size: 32px;
  margin-bottom: var(--space-lg);
}

#errorMessage {
  background: var(--data-surface);
  border-left: 4px solid var(--status-error);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin: var(--space-xl) 0;
  color: var(--text-primary);
  font-size: 16px;
  text-align: left;
}

/* ============================================
   FOOTER
   ============================================ */
.app-footer {
  background: linear-gradient(145deg, var(--panel-clean) 0%, var(--panel-clean-end) 100%);
  border-top: 1px solid var(--edge-light);
  padding: var(--space-lg);
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  box-shadow: var(--shadow-panel);
}

.app-footer a {
  color: var(--accent-orange);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.app-footer a:hover {
  text-shadow: 0 0 10px var(--accent-orange-glow);
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet and below (768px) */
@media (max-width: 768px) {
  .app-header {
    padding: var(--space-xl) var(--space-md);
  }

  .header-content h1 {
    font-size: 26px;
  }

  .subtitle {
    font-size: 14px;
  }

  /* Header Controls - Stack vertically */
  .header-controls {
    top: var(--space-sm);
    right: var(--space-sm);
    gap: var(--space-sm);
    flex-direction: column;
    align-items: flex-end;
  }

  .c-theme-toggle {
    padding: 6px 10px;
    font-size: 12px;
    gap: 4px;
  }

  .c-theme-toggle #themeText {
    display: none; /* Hide text, show only icon */
  }

  /* Model Selector - Compact on tablet */
  .model-selector {
    padding: 4px 8px;
  }

  .model-label {
    font-size: 11px;
  }

  .model-select {
    min-width: 100px;
    font-size: 11px;
    padding: 3px 6px;
  }

  .model-status {
    font-size: 10px;
    padding: 2px 4px;
  }

  .app-main {
    padding: var(--space-lg) var(--space-md);
  }

  .section-content {
    padding: var(--space-lg);
  }

  .section-content h2 {
    font-size: 20px;
  }

  .action-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .action-card {
    padding: var(--space-lg);
  }

  .action-card h3 {
    font-size: 16px;
  }

  /* Text Input Controls - Stack vertically on tablets */
  .text-input-controls {
    grid-template-columns: 1fr;
  }

  /* Processing Mode - Better layout */
  .processing-mode {
    padding: var(--space-sm) var(--space-md);
  }

  .mode-label strong {
    font-size: 13px;
  }

  .mode-description {
    font-size: 11px;
  }

  /* Buttons - Better touch targets */
  .btn {
    min-height: 48px;
    padding: 14px 20px;
    font-size: 15px;
  }

  .action-buttons {
    gap: var(--space-md);
  }

  /* Results Section */
  .complexity-grid {
    grid-template-columns: 1fr;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  #resultsTitle {
    font-size: 20px;
  }

  .results-actions {
    width: 100%;
    flex-direction: column;
  }

  .results-actions .btn {
    width: 100%;
  }

  .roles-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

/* Mobile phones (480px and below) */
@media (max-width: 480px) {
  .app-header {
    padding: var(--space-lg) var(--space-sm);
  }

  .header-content h1 {
    font-size: 22px;
    margin-bottom: var(--space-xs);
  }

  .header-content h1::before {
    content: '🏗️\A'; /* Line break after emoji */
    white-space: pre;
  }

  .subtitle {
    font-size: 13px;
  }

  /* Header Controls - Mobile */
  .header-controls {
    top: var(--space-xs);
    right: var(--space-xs);
    gap: 4px;
  }

  .c-theme-toggle {
    padding: 6px 10px;
    font-size: 16px;
    min-width: 36px;
    min-height: 36px;
    justify-content: center;
  }

  /* Model Selector - Hide label on mobile */
  .model-selector {
    padding: 4px 6px;
  }

  .model-label {
    display: none; /* Hide label on small screens */
  }

  .model-select {
    min-width: 80px;
    font-size: 10px;
    padding: 2px 4px;
  }

  .model-status {
    font-size: 9px;
    padding: 1px 3px;
  }

  .app-main {
    padding: var(--space-md) var(--space-sm);
  }

  .section-content {
    padding: var(--space-md);
    border-radius: var(--radius-lg);
  }

  .section-content h2 {
    font-size: 18px;
    margin-bottom: var(--space-lg);
  }

  .action-card {
    padding: var(--space-md);
  }

  .action-icon {
    font-size: 40px;
    margin-bottom: var(--space-xs);
  }

  .action-card h3 {
    font-size: 15px;
  }

  .action-card p {
    font-size: 13px;
  }

  /* File Upload Area - Smaller on mobile */
  .file-upload-area {
    padding: var(--space-lg);
  }

  .upload-text {
    font-size: 13px;
  }

  /* Textarea and Inputs - Full width, better touch */
  textarea {
    font-size: 15px; /* Prevent iOS zoom */
    min-height: 100px;
  }

  input[type="text"],
  input[type="number"] {
    font-size: 15px; /* Prevent iOS zoom */
    min-height: 48px;
  }

  /* Processing Mode - Compact layout */
  .processing-mode {
    padding: var(--space-sm);
    margin: var(--space-sm) 0;
  }

  .mode-toggle {
    gap: var(--space-xs);
  }

  .mode-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
  }

  .mode-label strong {
    font-size: 12px;
  }

  .mode-description {
    font-size: 10px;
    line-height: 1.3;
  }

  .action-hint {
    font-size: 11px;
    margin-top: var(--space-xs);
  }

  /* Buttons - Full width, larger touch targets */
  .btn {
    width: 100%;
    min-height: 52px;
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 600;
  }

  .action-buttons {
    gap: var(--space-sm);
  }

  /* Results Section - Compact */
  .results-container {
    padding: var(--space-md);
    min-height: 300px;
  }

  .results-header {
    margin-bottom: var(--space-lg);
  }

  #resultsTitle {
    font-size: 18px;
  }

  .results-actions {
    gap: var(--space-sm);
  }

  /* Tables on mobile - Better readability */
  .results-container table {
    font-size: 12px;
    min-width: 500px;
  }

  .results-container table th,
  .results-container table td {
    padding: var(--space-xs) var(--space-sm);
  }

  .result-item {
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
  }

  .result-item h4 {
    font-size: 14px;
  }

  .result-item p {
    font-size: 13px;
  }

  .result-code {
    font-size: 14px;
  }

  /* Info Panels - Compact */
  .info-panel {
    padding: var(--space-md);
    margin-bottom: var(--space-md);
  }

  .info-panel h3 {
    font-size: 16px;
    margin-bottom: var(--space-md);
  }

  .complexity-level {
    font-size: 28px;
  }

  .complexity-details p {
    font-size: 13px;
  }

  .roles-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .role-card {
    padding: var(--space-sm);
  }

  .role-card .role-icon {
    font-size: 28px;
    margin-bottom: var(--space-xs);
  }

  .role-card .role-name {
    font-size: 13px;
  }

  /* Footer - Compact */
  .app-footer {
    padding: var(--space-md) var(--space-sm);
    font-size: 12px;
  }

  /* Error Section */
  .error-content {
    padding: var(--space-lg);
  }

  .error-content h2 {
    font-size: 24px;
    margin-bottom: var(--space-md);
  }

  #errorMessage {
    padding: var(--space-md);
    margin: var(--space-md) 0;
    font-size: 14px;
  }
}

/* Very small phones (360px and below) */
@media (max-width: 360px) {
  .header-content h1 {
    font-size: 20px;
  }

  .subtitle {
    font-size: 12px;
  }

  .action-icon {
    font-size: 36px;
  }

  .btn {
    font-size: 14px;
    padding: 14px 16px;
  }

  .section-content h2 {
    font-size: 16px;
  }
}

/* Landscape mode fixes for mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .app-header {
    padding: var(--space-md) var(--space-lg);
  }

  .header-content h1 {
    font-size: 24px;
  }

  .header-content h1::before {
    content: '🏗️ '; /* Inline emoji in landscape */
  }

  .c-theme-toggle {
    top: var(--space-xs);
    right: var(--space-xs);
    padding: 6px 10px;
  }

  .app-main {
    padding: var(--space-md) var(--space-lg);
  }

  /* Keep action grid single column in landscape for better readability */
  .action-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   BATCH MODE STYLES
   ============================================================================ */

.batch-input-area {
  background: var(--bg-secondary);
  padding: var(--space-lg);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-lg);
}

.batch-input-area h3,
.batch-input-area h4 {
  margin-top: 0;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

#batchTextInput {
  width: 100%;
  min-height: 200px;
  padding: var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-family: monospace;
  font-size: 14px;
  resize: vertical;
  background: var(--bg-primary);
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.batch-settings {
  margin: var(--space-lg) 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}

.settings-grid label {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  font-weight: 500;
}

.settings-grid select {
  padding: var(--space-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
}

.batch-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

/* Progress */
.batch-progress {
  background: var(--bg-secondary);
  padding: var(--space-lg);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-lg);
}

.progress-bar-container {
  width: 100%;
  height: 30px;
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  overflow: hidden;
  margin: var(--space-md) 0;
  border: 1px solid var(--border-color);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
}

.progress-text {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  margin: var(--space-sm) 0;
  color: var(--text-primary);
}

.progress-details {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.progress-details span {
  margin: 0 var(--space-md);
}

/* Results Table */
.batch-results {
  background: var(--bg-secondary);
  padding: var(--space-lg);
  border-radius: var(--border-radius);
}

.table-wrapper {
  overflow-x: auto;
  margin: var(--space-md) 0;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--bg-primary);
  border-radius: var(--border-radius);
}

.results-table th {
  background: var(--accent-primary);
  color: white;
  padding: var(--space-md);
  text-align: left;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.results-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.results-table tr:hover {
  background: var(--bg-secondary);
}

.results-table tr.high-confidence {
  background: rgba(76, 175, 80, 0.1);
}

.results-table tr.low-confidence {
  background: rgba(255, 193, 7, 0.1);
}

.results-table tr.error-row {
  background: rgba(244, 67, 54, 0.1);
}

.confidence-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.confidence-badge.high {
  background: #4CAF50;
  color: white;
}

.confidence-badge.medium {
  background: #FF9800;
  color: white;
}

.confidence-badge.low {
  background: #FFC107;
  color: black;
}

/* TSKP Section Badge */
.tskp-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: #E3F2FD;
  color: #1565C0;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: help;
}

.tskp-missing {
  color: #999;
}

/* Source Badge */
.source-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 500;
  margin-left: 4px;
  text-transform: uppercase;
}

.source-badge.source-perplexity {
  background: #E8EAF6;
  color: #283593;
}

.source-badge.source-brave_search {
  background: #FFF3E0;
  color: #E65100;
}

.source-badge.source-otskp {
  background: #E8F5E9;
  color: #2E7D32;
}

.source-badge.source-local {
  background: #F3E5F5;
  color: #6A1B9A;
}
