/* ========================================
   Reset & Base Styles
   ======================================== */

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

body,
html {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #ffffff;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

body {
  position: fixed;
  inset: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ========================================
   App Layout Container (7-Zone Vertical Flex)
   ======================================== */

.app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
}

/* ========================================
   Zone 1: Top Navigation Bar
   ======================================== */

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  pointer-events: auto;
  min-height: 44px;
}

.nav-icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #333333;
  background: none;
  border: none;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-title {
  font-size: 17px;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: 0.2px;
}

/* ========================================
   Zone 2–3: Unified Welcome Panel
   ======================================== */

.welcome-panel {
  flex-shrink: 0;
  background: #f7f7f8;
  pointer-events: auto;
  will-change: transform, opacity, max-height;
  transform-origin: top center;
}

.welcome-header {
  display: flex;
  align-items: center;
  padding: 20px 24px 0;
  gap: 16px;
}

.welcome-avatar {
  width: 25%;
  max-width: 100px;
  flex-shrink: 0;
  line-height: 0;
}

.welcome-avatar img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

.welcome-greeting {
  flex: 1;
  font-size: 24px;
  font-weight: 800;
  color: #0a0a0a;
  line-height: 1.4;
  letter-spacing: 0.2px;
}

/* Prompt Chips (nested within Welcome Panel) */

.prompt-chips {
  padding: 8px 0 12px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chip-row {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.suggestion-chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1px solid #d8d8da;
  border-radius: 20px;
  font-size: 14px;
  color: #333333;
  background: transparent;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  line-height: 1.4;
  transition: background 0.15s ease;
}

.suggestion-chip:active {
  background: #f0f0f2;
}

/* ========================================
   Zone 4: Main Chat Area
   ======================================== */

.chat-area {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: transparent;
  pointer-events: none;
}

/* ========================================
   Zone 5: Disclaimer Bar
   ======================================== */

.disclaimer-bar {
  padding: 8px 20px 4px;
  text-align: center;
  flex-shrink: 0;
  background: #ffffff;
  pointer-events: auto;
}

.disclaimer-text {
  font-size: 11px;
  color: #999999;
  line-height: 1.4;
}

/* ========================================
   Zone 6: Bottom Quick-Action Pills
   ======================================== */

.quick-actions {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  flex-shrink: 0;
  background: #ffffff;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  pointer-events: auto;
}

.quick-actions::-webkit-scrollbar {
  display: none;
}

.action-pill {
  flex-shrink: 0;
  padding: 8px 16px;
  border: 1px solid #d8d8da;
  border-radius: 20px;
  font-size: 14px;
  color: #333333;
  background: #ffffff;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  line-height: 1.4;
  transition: background 0.15s ease;
}

.action-pill:active {
  background: #f0f0f2;
}

/* ========================================
   Zone 7: Bottom Input Bar
   ======================================== */

.input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  pointer-events: auto;
}

.camera-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #666666;
  cursor: pointer;
  border: none;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.camera-btn svg {
  width: 22px;
  height: 22px;
}

.message-input {
  flex: 1;
  height: 40px;
  border: 1.5px solid #d8d8da;
  border-radius: 20px;
  padding: 0 16px;
  font-size: 15px;
  color: #333333;
  background: #f7f7f8;
  outline: none;
  -webkit-appearance: none;
  font-family: inherit;
}

.message-input::placeholder {
  color: #aaaaaa;
}

.message-input:focus {
  border-color: #b0b0b2;
  background: #ffffff;
}

.send-msg-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: #17494d;
  color: #ffffff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  transition: opacity 0.2s, transform 0.2s;
}

.send-msg-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.send-msg-btn:not(:disabled):active {
  transform: scale(0.92);
}

.send-msg-btn svg {
  width: 18px;
  height: 18px;
}

/* ========================================
   Image Preview Bar (between Zone 6 & 7)
   ======================================== */

.image-preview-bar {
  display: none;
  padding: 8px 16px 4px;
  background: #ffffff;
  flex-shrink: 0;
  pointer-events: auto;
}

.image-preview-container {
  display: inline-flex;
  position: relative;
}

.image-preview-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.image-preview-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  border: 2px solid #ffffff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

/* Hidden file input for camera/gallery */

#cameraFileInput {
  display: none;
}

/* ========================================
   Locale Dropdown
   ======================================== */

.locale-dropdown {
  position: fixed;
  z-index: 999999;
  min-width: 200px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.12),
    0 1px 4px rgba(0, 0, 0, 0.08);
  padding: 6px 0;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.locale-dropdown.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.locale-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: #333333;
  cursor: pointer;
  transition: background 0.12s ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  min-height: 40px;
}

.locale-option:active,
.locale-option:hover {
  background: #f5f5f7;
}

.locale-option.active {
  color: #17494D;
  font-weight: 600;
}

.locale-option-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #999999;
}

.locale-option.active .locale-option-icon {
  color: #17494D;
}

.locale-option-icon svg {
  width: 16px;
  height: 16px;
}

.locale-option-check {
  margin-left: auto;
  display: flex;
  align-items: center;
  color: #17494D;
}

.locale-option-check svg {
  width: 16px;
  height: 16px;
}

/* ========================================
   Menu Dropdown
   ======================================== */

.deus-menu-dropdown {
  position: fixed;
  z-index: 999999;
  min-width: 180px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.2);
  padding: 4px 0;
}

.deus-menu-dropdown.open {
  display: flex;
}

/* Menu Items */

.deus-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  color: #CBD5E1;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
  user-select: none;
  -webkit-user-select: none;
}

.deus-menu-item:active {
  background: rgba(255, 255, 255, 0.1);
}

.deus-menu-item.active {
  color: #5EEAD4;
}

/* Menu Icon */

.deus-menu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.deus-menu-icon svg {
  width: 16px;
  height: 16px;
}

/* Menu Status Badge */

.deus-menu-status {
  margin-left: auto;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0.6;
}

.deus-menu-item.active .deus-menu-status {
  color: #5EEAD4;
  opacity: 1;
}

/* ========================================
   Debug Console
   ======================================== */

.deus-debug-console {
  height: 0;
  flex-shrink: 0;
  background: #0F172A;
  border-top: 1px solid #334155;
  display: none;
  flex-direction: column;
  font-family: 'Courier New', Courier, monospace;
  pointer-events: auto;
  overflow: hidden;
}

.deus-debug-console.visible {
  display: flex;
  height: 180px;
}

/* Console Header */

.deus-debug-console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #1E293B;
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
}

.deus-debug-console-title {
  font-size: 11px;
  font-weight: 600;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.deus-debug-console-title i {
  color: #5EEAD4;
}

/* Console Buttons */

.deus-debug-console-btn {
  padding: 2px 8px;
  border: 1px solid #334155;
  border-radius: 4px;
  background: transparent;
  color: #94A3B8;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.deus-debug-console-btn:hover {
  background: #334155;
  color: #E2E8F0;
}

.deus-debug-console-actions {
  display: flex;
  gap: 6px;
}

.deus-debug-console-close {
  color: #F87171;
  border-color: #4B2020;
}

.deus-debug-console-close:hover {
  background: #4B2020;
  color: #FCA5A5;
}

/* Console Body & Entries */

.deus-debug-console-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
  font-size: 11px;
}

.deus-debug-entry {
  padding: 2px 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.2);
}

.deus-debug-entry:hover {
  background: rgba(51, 65, 85, 0.3);
}

.deus-debug-entry-time {
  color: #475569;
  flex-shrink: 0;
  min-width: 65px;
}

.deus-debug-entry-type {
  flex-shrink: 0;
  min-width: 36px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  text-align: center;
}

/* Entry Type Colors */

.deus-debug-entry.log .deus-debug-entry-type {
  color: #94A3B8;
  background: rgba(148, 163, 184, 0.1);
}

.deus-debug-entry.info .deus-debug-entry-type {
  color: #38BDF8;
  background: rgba(56, 189, 248, 0.1);
}

.deus-debug-entry.warn .deus-debug-entry-type {
  color: #FBBF24;
  background: rgba(251, 191, 36, 0.1);
}

.deus-debug-entry.error .deus-debug-entry-type {
  color: #F87171;
  background: rgba(248, 113, 113, 0.1);
}

/* Entry Message Text */

.deus-debug-entry-msg {
  color: #CBD5E1;
  word-break: break-all;
  flex: 1;
}

.deus-debug-entry.warn .deus-debug-entry-msg {
  color: #FBBF24;
}

.deus-debug-entry.error .deus-debug-entry-msg {
  color: #F87171;
}
