/* ==========================================================================
   BROWSER - HIGH-TECH MONOCHROME ARCHITECTURE
   URL BAR + OUTPUT // PERSISTENT LOCALSTORAGE // ZERO EMOJIS
   ========================================================================== */

:root {
  --color-bg: #000000;
  --color-surface: #0a0a0a;
  --color-card: #121212;
  --color-input: #141414;
  --color-text: #ffffff;
  --color-text-dim: #777777;
  --color-text-muted: #444444;
  --color-border: #262626;
  --color-border-bright: #ffffff;
  
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Courier New', monospace;
  --bar-height: 44px;
}

/* Background Variations */
body.bg-black {
  --color-bg: #000000;
  --color-surface: #0a0a0a;
  background-color: var(--color-bg);
}

body.bg-steel {
  --color-bg: #0c0d10;
  --color-surface: #131418;
  background-color: var(--color-bg);
}

body.bg-grid {
  --color-bg: #000000;
  --color-surface: #0a0a0a;
  background-color: #000000;
  background-image: 
    linear-gradient(to right, #141414 1px, transparent 1px),
    linear-gradient(to bottom, #141414 1px, transparent 1px);
  background-size: 24px 24px;
}

body.bg-dots {
  --color-bg: #000000;
  --color-surface: #0a0a0a;
  background-color: #000000;
  background-image: radial-gradient(#222222 1px, transparent 1px);
  background-size: 16px 16px;
}

body.bg-white {
  --color-bg: #ffffff;
  --color-surface: #f4f4f4;
  --color-card: #e8e8e8;
  --color-input: #ffffff;
  --color-text: #000000;
  --color-text-dim: #555555;
  --color-text-muted: #999999;
  --color-border: #cccccc;
  --color-border-bright: #000000;
  background-color: var(--color-bg);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-mono);
  color: var(--color-text);
  font-size: 12px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* ==================== HIGH-TECH TOP BAR ==================== */
#browser-bar {
  height: var(--bar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
  position: relative;
  z-index: 1000;
  user-select: none;
}

.nav-cluster {
  display: flex;
  gap: 4px;
}

.tech-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 0 8px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.tech-btn:hover:not(:disabled) {
  background: var(--color-text);
  color: var(--color-bg);
  border-color: var(--color-text);
}

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

.tech-btn.btn-dim {
  color: var(--color-text-dim);
  border-color: var(--color-border);
}

.tech-btn.btn-dim:hover {
  color: var(--color-text);
  border-color: var(--color-text);
  background: var(--color-card);
}

.tech-btn.btn-mini {
  height: 24px;
  font-size: 10px;
  padding: 0 6px;
}

.tech-btn.btn-danger {
  color: var(--color-text);
  border-color: var(--color-border);
}

.tech-btn.btn-danger:hover {
  background: #ff3333;
  color: #000000;
  border-color: #ff3333;
}

/* Omnibox / URL Form */
.omnibox-container {
  flex: 1;
  position: relative;
}

#url-form {
  display: flex;
  align-items: center;
  height: 30px;
  gap: 4px;
}

.url-input-wrap {
  flex: 1;
  height: 100%;
  background: var(--color-input);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 6px;
  transition: border-color 0.12s ease;
}

.url-input-wrap:focus-within {
  border-color: var(--color-border-bright);
}

.engine-badge {
  font-size: 9px;
  font-weight: 800;
  background: var(--color-text);
  color: var(--color-bg);
  padding: 1px 4px;
  margin-right: 6px;
  letter-spacing: 0.5px;
}

#url-input {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 11px;
  outline: none;
}

.clear-btn {
  background: transparent;
  border: none;
  color: var(--color-text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  padding: 2px 4px;
}

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

.btn-go {
  padding: 0 12px;
}

.tools-cluster {
  display: flex;
  gap: 4px;
}

/* ==================== AUTOCOMPLETE SUGGESTIONS ==================== */
.suggestions-box {
  position: absolute;
  top: 34px;
  left: 0;
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border-bright);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
  max-height: 260px;
  overflow-y: auto;
  z-index: 2000;
}

.suggestions-box.hidden {
  display: none !important;
}

.sugg-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.1s ease;
}

.sugg-item:hover, .sugg-item.selected {
  background: var(--color-card);
}

.sugg-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.sugg-tag {
  font-size: 9px;
  color: var(--color-text-dim);
  border: 1px solid var(--color-border);
  padding: 1px 4px;
}

.sugg-text {
  font-size: 11px;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sugg-del {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  padding: 2px 6px;
}

.sugg-del:hover {
  color: var(--color-text);
}

/* ==================== LOADING BAR ==================== */
#loading-bar {
  height: 2px;
  width: 0%;
  background: var(--color-text);
  transition: width 0.25s ease, opacity 0.3s ease;
}

#loading-bar.active {
  width: 80%;
}

#loading-bar.done {
  width: 100%;
  opacity: 0;
}

/* ==================== BROWSER OUTPUT VIEWPORT ==================== */
#browser-output {
  width: 100%;
  height: calc(100vh - var(--bar-height) - 2px);
  position: relative;
  background: #ffffff;
}

.viewport-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
  display: block;
}

.viewport-frame.hidden {
  display: none !important;
}

/* ==================== START / HOME SCREEN ==================== */
.start-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.start-page.hidden {
  display: none !important;
}

.start-box {
  max-width: 680px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.system-badge {
  font-size: 10px;
  color: var(--color-text-dim);
  letter-spacing: 2px;
}

.brand-title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 14px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.brand-sub {
  font-size: 10px;
  color: var(--color-text-dim);
  letter-spacing: 2px;
}

.start-search {
  display: flex;
  border: 1px solid var(--color-border);
  background: var(--color-input);
  height: 42px;
  align-items: center;
  padding: 0 4px;
}

.start-search-badge {
  font-size: 10px;
  color: var(--color-text-dim);
  padding: 0 8px;
}

#start-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  padding: 0 8px;
}

.start-btn {
  background: var(--color-text);
  color: var(--color-bg);
  border: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 0 16px;
  height: 32px;
  cursor: pointer;
}

.start-btn:hover {
  background: #cccccc;
}

/* Shortcuts Grid */
.shortcuts-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 16px;
}

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

.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.shortcut-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.shortcut-pill:hover {
  border-color: var(--color-border-bright);
  background: var(--color-text);
  color: var(--color-bg);
}

.shortcut-pill:hover .shortcut-name {
  color: var(--color-bg);
}

.shortcut-pill:hover .shortcut-del {
  color: var(--color-bg);
}

.shortcut-name {
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shortcut-del {
  background: transparent;
  border: none;
  color: var(--color-text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}

.shortcut-del:hover {
  color: #ff3333;
}

/* Inline Add Shortcut Modal */
.inline-modal {
  border: 1px solid var(--color-border-bright);
  background: var(--color-surface);
  padding: 16px;
}

.inline-modal.hidden {
  display: none;
}

.modal-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}

.modal-box input {
  background: var(--color-input);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 8px 10px;
  outline: none;
}

.modal-actions {
  display: flex;
  gap: 8px;
}

/* ==================== DRAWERS (HISTORY & SETTINGS) ==================== */
.drawer {
  position: fixed;
  top: var(--bar-height);
  right: 0;
  width: 380px;
  height: calc(100vh - var(--bar-height));
  background: var(--color-surface);
  border-left: 1px solid var(--color-border-bright);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  z-index: 3000;
}

.drawer.hidden {
  display: none !important;
}

.drawer-header {
  height: 44px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
}

.drawer-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}

.drawer-actions {
  display: flex;
  gap: 6px;
}

.drawer-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
}

.drawer-search input {
  width: 100%;
  background: var(--color-input);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 8px;
  outline: none;
}

.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.1s ease;
}

.history-item:hover {
  background: var(--color-card);
}

.hist-info {
  flex: 1;
  overflow: hidden;
  margin-right: 8px;
}

.hist-time {
  font-size: 9px;
  color: var(--color-text-dim);
  margin-bottom: 2px;
}

.hist-url {
  font-size: 11px;
  color: var(--color-text);
  word-break: break-all;
}

.hist-del {
  background: transparent;
  border: none;
  color: var(--color-text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  padding: 2px;
}

.hist-del:hover {
  color: #ff3333;
}

/* Settings Body */
.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 16px;
}

.setting-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}

.setting-desc {
  font-size: 10px;
  color: var(--color-text-dim);
  line-height: 1.4;
}

.tech-select {
  background: var(--color-input);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 8px;
  outline: none;
  cursor: pointer;
}

.bg-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.bg-btn {
  background: var(--color-input);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 6px;
  cursor: pointer;
}

.bg-btn:hover {
  border-color: var(--color-border-bright);
}

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

.custom-bg-row {
  display: flex;
  gap: 6px;
}

.custom-bg-row input {
  flex: 1;
  background: var(--color-input);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 8px;
  outline: none;
}

.danger-zone {
  border-color: #331111;
}

@media (max-width: 600px) {
  .drawer {
    width: 100%;
  }
}
