/* Styles moved from newtab.html */
:root {
  /* Default Dark theme */
  --bg: #0b0f14;
  --bg-2: #0d1218;
  --grid: rgba(255,255,255,0.04);
  --text: #c9d1d9;
  --muted: #8b949e;
  --accent: #58a6ff;
  --accent-2: #7ee787;
  --accent-3: #f2cc60;
  --shadow: rgba(0,0,0,0.35);
  --card: #11161d;
  --card-2: #0f141a;
  --border: #1f2630;
  --mac-red: #ff5f57;
  --mac-yellow: #febc2e;
  --mac-green: #28c840;
}

/* Light theme */
html.theme-light {
  --bg: #ffffff;
  --bg-2: #f6f8fa;
  --grid: rgba(0,0,0,0.04);
  --text: #24292f;
  --muted: #57606a;
  --accent: #0969da;
  --accent-2: #1a7f37;
  --accent-3: #9e6a03;
  --shadow: rgba(0,0,0,0.1);
  --card: #f6f8fa;
  --card-2: #eaeef2;
  --border: #d0d7de;
}

/* Purple theme */
html.theme-purple {
  --bg: #1a1625;
  --bg-2: #2d2440;
  --grid: rgba(200,100,255,0.08);
  --text: #e8d5f2;
  --muted: #b8a0cc;
  --accent: #d946ef;
  --accent-2: #c026d3;
  --accent-3: #f59e0b;
  --shadow: rgba(105,20,180,0.3);
  --card: #2d2440;
  --card-2: #1f1930;
  --border: #523a70;
}

/* Green theme */
html.theme-green {
  --bg: #1a2e1f;
  --bg-2: #232d24;
  --grid: rgba(76,175,80,0.06);
  --text: #c5d5c0;
  --muted: #8fa89f;
  --accent: #66bb6a;
  --accent-2: #558b5c;
  --accent-3: #a4a853;
  --shadow: rgba(0,0,0,0.25);
  --card: #232d24;
  --card-2: #1a2e1f;
  --border: #3d5a44;
}

/* Reset and layout */
* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
}
.app {
  position: relative;
  min-height: 100%;
  overflow: hidden;
}


.bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1200px 600px at 50% -30%, rgba(88,166,255,0.15), transparent 60%),
    radial-gradient(800px 400px at 80% 120%, rgba(126,231,135,0.08), transparent 60%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
  filter: saturate(1.1);
}

.scanlines {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.02) 0px,
    rgba(255,255,255,0.02) 1px,
    transparent 2px,
    transparent 4px
  );
  mix-blend-mode: soft-light;
  animation: flicker 6s infinite;
}
@keyframes flicker {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.35; }
}


.matrix {
  position: absolute; inset: 0;
  opacity: 0.12;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0;
  padding: 0 8px;
  filter: drop-shadow(0 0 2px rgba(88,166,255,0.4));
}
.col {
  position: relative;
  overflow: hidden;
}
.stream {
  position: absolute;
  top: -120%;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 240%;
  background:
    linear-gradient(to bottom,
      rgba(88,166,255,0) 0%,
      rgba(88,166,255,0.6) 30%,
      rgba(88,166,255,0.9) 50%,
      rgba(88,166,255,0.5) 70%,
      rgba(88,166,255,0) 100%);
  animation: drop 8s linear infinite;
}
.col:nth-child(odd) .stream { animation-duration: 10s; }
.col:nth-child(3n) .stream { animation-duration: 12s; }
@keyframes drop {
  0% { top: -120%; }
  100% { top: 0%; }
}


.center {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 32px;
}
.stack {
  width: min(900px, 92vw);
  display: grid;
  gap: 16px;
}


.search-card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow:
    0 10px 30px var(--shadow),
    inset 0 1px 0 rgba(255,255,255,0.04);
  padding: 18px;
}
.search-title {
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin: 0 0 10px 4px;
  font-size: 14px;
}
.search {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 18px;
  padding: 10px 12px;
}
.search input::placeholder { color: var(--muted); }
.engine {
  display: flex; align-items: center; gap: 10px;
}
.engine select, .engine button {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}
.engine button {
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--border);
}
.engine button:hover {
  border-color: #3a4a63;
}

/* Mac-style window boxes */
/* layout */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  align-items: start;
  box-sizing: border-box;
  grid-auto-rows: minmax(120px, auto);
}

/* window card */
.window {
  grid-column: span 6;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  border-radius: var(--radius, 10px);
  box-shadow: 0 12px 24px var(--shadow, rgba(2,6,23,0.6));
  overflow: hidden;
  user-select: none;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 120px;
}

/* header and content helpers */
.window .window-header { flex: 0 0 auto; }
.window .window-content { flex: 1 1 auto; padding: 12px; }

/* accessibility */
.window:focus-within { outline: 2px solid rgba(158,203,255,0.12); }

/* responsive: make windows full width on small screens */
@media (max-width: 900px) {
  .window { grid-column: 1 / -1; }
}

/* optional: allow different spans */
.window.span-3 { grid-column: span 3; }
.window.span-4 { grid-column: span 4; }
.window.span-6 { grid-column: span 6; }
.window.span-12 { grid-column: 1 / -1; }

    .window-header {
      display: flex; align-items: center; gap: 10px;
      padding: 10px 12px;
      background: linear-gradient(180deg, var(--card-2), var(--card));
      border-bottom: 1px solid var(--border);
      cursor: move;
    }
    .traffic {
      display: flex; gap: 8px;
    }
    .dot {
      width: 12px; height: 12px;
      border-radius: 50%;
      box-shadow: inset 0 1px 2px rgba(0,0,0,0.6), 0 0 6px rgba(255,255,255,0.08);
    }
    .red { background: var(--mac-red); }
    .yellow { background: var(--mac-yellow); }
    .green { background: var(--mac-green); }

    .title {
      font-size: 13px;
      color: var(--muted);
      flex: 1;
    }
    .window-content {
      padding: 16px;
      font-size: 14px;
      color: var(--text);
    }

    /* Terminal-styled content area */
    .terminal {
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
      background: var(--bg-2);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px;
      position: relative;
      overflow: hidden;
    }
    .line {
      display: block;
      white-space: pre;
      color: var(--accent);
    }
    .cursor {
      display: inline-block;
      width: 9px; height: 1.1em;
      background: var(--accent);
      margin-left: 6px;
      animation: blink 1s steps(1) infinite;
      vertical-align: text-bottom;
    }
    @keyframes blink {
      50% { opacity: 0; }
    }

    /* Settings popup inputs and buttons */
    #settingsPopup input[type="text"],
    #settingsPopup input[type="checkbox"] {
      border-color: var(--border);
      background: var(--bg-2);
      color: var(--text);
    }
    #settingsPopup button[id$="Btn"] {
      background: var(--card-2);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 8px 12px;
      color: var(--text);
      cursor: pointer;
      margin-bottom: 12px;
    }
    #settingsPopup button[id$="Btn"]:hover {
      background: var(--card);
    }

    /* Responsive */
    @media (max-width: 900px) {
      .window { grid-column: span 12; }
    }

  .setting-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }

  .setting-group label {
    font-weight: 500;
    color: var(--text);
  }

  .setting-group select {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
  }

  .setting-group select:hover {
    border-color: var(--accent);
  }

  #shortcutForm button {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
  }

  #shortcutForm input {
      color: var(--text);
      padding: 10px 12px;
      border: 1px solid var(--border);
      border-radius: 15px;
      background: transparent;
  }

  #shortcutForm {
    padding-top: 10px;
  }

  #clearCustomShortcuts {
    width: 100%;
    color: var(--text);
    padding: 10px 12px;
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: transparent;
  }

  #clearCustomShortcuts:hover {
    border: 1px solid var(--muted);
  }
