/* Antigravity IDE Light Theme System — Mobile-First Architecture */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Antigravity IDE Light Theme Palette */
  --bg-main: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-card-selected: #eff6ff;
  --bg-input: #ffffff;
  --bg-code: #f1f5f9;
  
  --border-color: #e2e8f0;
  --border-active: #3b82f6;
  --border-focus: #2563eb;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --accent-primary: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.12);
  
  --whatsapp-green: #10b981;
  --whatsapp-hover: #059669;

  --word-blue: #2563eb;
  --word-hover: #1d4ed8;

  --status-active-bg: #dbeafe;
  --status-active-text: #1e40af;
  --status-completed-bg: #d1fae5;
  --status-completed-text: #065f46;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-tooltip: 0 8px 20px rgba(15, 23, 42, 0.2);

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  padding-bottom: 40px;
}

/* Antigravity IDE Header Top Bar */
.ide-top-header {
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-subtle);
  position: sticky;
  top: 0;
  z-index: 200;
  flex-wrap: wrap;
  gap: 6px;
}

.ide-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-primary);
}

.ide-brand span.tag {
  background: var(--accent-glow);
  color: var(--accent-primary);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-size: 10.5px;
}

.ide-motto {
  font-size: 11px;
  font-weight: 700;
  color: #d97706;
  background: #fef3c7;
  border: 1px solid #fde68a;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

/* =========================================================
   MOBILE-FIRST DEFAULT LAYOUT (Fits all smartphones 320px+)
   ========================================================= */
.app-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Sidebar on Mobile */
.sidebar {
  width: 100%;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-subtle);
}

/* Selected Document Action Bar (Touch Icons Toolbar) */
.selected-doc-actions {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
}

.selected-doc-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.selected-doc-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Icon Action Grid */
.action-icon-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.btn-ide-icon {
  width: 100%;
  height: 44px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.btn-ide-icon:hover, .btn-ide-icon:active {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  color: var(--accent-primary);
}

/* Floating Tooltip */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #0f172a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-sans);
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-tooltip);
  z-index: 1000;
}

[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Categories Section — Horizontal Scroll On Mobile */
.nav-section {
  margin-bottom: 10px;
}

.nav-section-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 6px;
}

.nav-chips-container {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  gap: 6px;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.filter-chip {
  flex-shrink: 0;
  width: auto;
  text-align: left;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--bg-card-selected);
  border-color: var(--border-active);
  color: var(--accent-primary);
}

/* Main Workspace */
.main-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Search Bar */
.search-box {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  height: 42px;
  padding: 8px 14px 8px 38px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-subtle);
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

/* Document Cards List — Mobile-First Stacked Cards */
.doc-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-row {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-subtle);
}

.doc-row:hover {
  background: var(--bg-card-hover);
  border-color: #cbd5e1;
}

.doc-row.selected {
  background: var(--bg-card-selected);
  border-color: var(--border-active);
}

.doc-main-info {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.doc-type-badge {
  display: flex;
  align-items: center;
  color: var(--accent-primary);
  margin-top: 2px;
  flex-shrink: 0;
}

.doc-text-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.doc-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  word-break: break-word;
  white-space: normal;
}

.doc-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.doc-bottom-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

.doc-status-pill {
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-active {
  background: var(--status-active-bg);
  color: var(--status-active-text);
}

.status-completed {
  background: var(--status-completed-bg);
  color: var(--status-completed-text);
}

/* Icon Row Actions */
.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon-mini {
  width: 38px;
  height: 38px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon-mini:hover, .btn-icon-mini:active {
  background: var(--bg-sidebar);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Modal Window */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 780px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-tooltip);
}

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

.modal-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
}

.modal-body {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.transcript-box {
  background: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: 'Times New Roman', Times, serif;
  font-size: 14px;
  line-height: 1.55;
  color: #1e293b;
  white-space: pre-wrap;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  left: 16px;
  z-index: 2000;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-tooltip);
  pointer-events: auto;
}

/* =========================================================
   DESKTOP EXPANSION ONLY (min-width: 900px)
   ========================================================= */
@media (min-width: 900px) {
  .app-container {
    max-width: 1400px;
    padding: 16px 20px;
    display: grid;
    grid-template-columns: 310px 1fr;
    gap: 20px;
  }

  .sidebar {
    height: fit-content;
    position: sticky;
    top: 60px;
    padding: 16px;
  }

  .nav-chips-container {
    flex-direction: column;
    overflow-x: visible;
  }

  .filter-chip {
    width: 100%;
    justify-content: space-between;
    padding: 8px 12px;
  }

  .doc-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    gap: 16px;
  }

  .doc-main-info {
    width: auto;
    flex: 1;
  }

  .doc-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
  }

  .doc-bottom-bar {
    width: auto;
    border-top: none;
    padding-top: 0;
    gap: 16px;
  }
}
