/* ============================================================================
   Devin Web Gateway — shared CSS (theme variables + base styles)
   Modern Gemini-inspired aesthetic: soft outlines, hover fills, glassmorphism
   ============================================================================ */

:root {
  --bg: #0d1117;
  --bg-2: #010409;
  --bg-gradient: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(68,147,248,.10), transparent 70%), var(--bg);
  --panel: #161b22;
  --panel-2: #1c2330;
  --panel-3: #21262d;
  --border: #30363d;
  --border-2: #21262d;
  --text: #e6edf3;
  --text-2: #adbac7;
  --muted: #768390;
  --accent: #4493f8;
  --accent-bg: rgba(68,147,248,.12);
  --accent-2: #2f81f7;
  --accent-glow: rgba(68,147,248,.25);
  --green: #3fb950;
  --green-bg: rgba(63,185,80,.12);
  --green-glow: rgba(63,185,80,.2);
  --red: #f85149;
  --red-bg: rgba(248,81,73,.12);
  --red-glow: rgba(248,81,73,.2);
  --yellow: #d29922;
  --yellow-bg: rgba(210,153,34,.12);
  --yellow-glow: rgba(210,153,34,.2);
  --purple: #a371f7;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 12px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --sidebar-w: 260px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
  --shadow-md: 0 2px 8px rgba(0,0,0,.25), 0 1px 3px rgba(0,0,0,.2);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.2);
  --ring: 0 0 0 3px var(--accent-bg);

  /* ---- Scrim / overlay backdrops ---- */
  --overlay-scrim: rgba(0,0,0,.5);        /* standard modal overlay */
  --overlay-scrim-strong: rgba(0,0,0,.6); /* sessions modal (slightly heavier) */
  --scrim-btn: rgba(0,0,0,.7);            /* small button on image thumbnails */

  /* ---- Text on filled colored buttons (accent/danger/success fills) ---- */
  --text-on-fill: #fff;

  /* ---- Faint white overlays for hover/border on dark surfaces ---- */
  --text-faint-1: rgba(255,255,255,0.05); /* table borders, th hover */
  --text-faint-2: rgba(255,255,255,0.04); /* row hover */
  --text-faint-3: rgba(255,255,255,0.08); /* action button hover */

  /* ---- Semi-transparent panel for backdrop-filter blur surfaces ---- */
  --panel-blur: rgba(22,27,34,.8);

  /* ---- Plan-mode blue (distinct from --accent) ---- */
  --blue: #58a6ff;
  --blue-bg: rgba(88,166,255,.08);

  /* ---- Accent border variant (user message bubble) ---- */
  --accent-border: rgba(68,147,248,.2);

  /* ---- Bright green for live-session dots (brighter than --green) ---- */
  --green-bright: #22c55e;
  --green-bright-glow: rgba(34,197,94,0.6);

  /* ---- Breakpoints (documentation only — CSS vars can't be used in @media) ----
     --bp-sm: 600px   phones → small tablets
     --bp-md: 900px   tablets → small laptop
     --bp-lg: 1200px  laptop → desktop
     Use these values directly in @media queries for consistency. */
}
[data-theme="light"] {
  --bg: #ffffff;
  --bg-2: #f6f8fa;
  --bg-gradient: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(26,115,232,.06), transparent 70%), var(--bg);
  --panel: #ffffff;
  --panel-2: #f6f8fa;
  --panel-3: #eaeef2;
  --border: #d0d7de;
  --border-2: #eaeef2;
  --text: #1f2328;
  --text-2: #59636e;
  --muted: #818b98;
  --accent: #1a73e8;
  --accent-bg: rgba(26,115,232,.08);
  --accent-2: #1a73e8;
  --accent-glow: rgba(26,115,232,.2);
  --green: #1a7f37;
  --green-bg: rgba(26,127,55,.08);
  --green-glow: rgba(26,127,55,.15);
  --red: #d93025;
  --red-bg: rgba(217,48,37,.08);
  --red-glow: rgba(217,48,37,.15);
  --yellow: #e37400;
  --yellow-bg: rgba(227,116,0,.08);
  --yellow-glow: rgba(227,116,0,.15);
  --purple: #9334e6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.08);

  /* ---- Theme-aware overrides for new tokens ---- */
  --overlay-scrim: rgba(0,0,0,.5);
  --overlay-scrim-strong: rgba(0,0,0,.6);
  --scrim-btn: rgba(0,0,0,.7);
  --text-on-fill: #fff;
  --text-faint-1: rgba(0,0,0,0.05);
  --text-faint-2: rgba(0,0,0,0.04);
  --text-faint-3: rgba(0,0,0,0.08);
  --panel-blur: rgba(255,255,255,.8);
  --blue: #0969da;
  --blue-bg: rgba(9,105,218,.08);
  --accent-border: rgba(26,115,232,.15);
  --green-bright: #1a7f37;
  --green-bright-glow: rgba(26,127,55,0.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg-gradient); color: var(--text);
  font: 14px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== BUTTON SYSTEM ===== */
button { cursor: pointer; font-family: var(--sans); }
input, button, textarea {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px; font-size: 14px; outline: none;
  transition: all .2s var(--ease);
}
input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
button:disabled { opacity: .35; cursor: not-allowed; }

/* Primary: outline → fill on hover */
button.primary {
  background: transparent; border: 1.5px solid var(--accent); color: var(--accent);
  font-weight: 500; border-radius: var(--radius-pill); padding: 9px 20px;
  transition: all .25s var(--ease-out);
}
button.primary:hover:not(:disabled) {
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: translateY(-1px);
}
button.primary:active:not(:disabled) { transform: translateY(0); box-shadow: 0 2px 8px var(--accent-glow); }

/* Ghost: hairline → ring on hover */
button.ghost {
  background: transparent; border: 1px solid var(--border); color: var(--text-2);
  border-radius: var(--radius-sm); transition: all .2s var(--ease);
}
button.ghost:hover:not(:disabled) {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-bg);
  box-shadow: var(--ring);
}

/* Danger: outline → fill */
button.danger {
  background: transparent; border: 1.5px solid var(--red); color: var(--red);
  border-radius: var(--radius-sm); transition: all .25s var(--ease-out);
}
button.danger:hover:not(:disabled) {
  background: var(--red); color: #fff;
  box-shadow: 0 4px 16px var(--red-glow);
  transform: translateY(-1px);
}

/* Icon buttons: circular, ring on hover */
button.icon-btn {
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-pill);
  padding: 0; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  color: var(--text-2); transition: all .2s var(--ease);
}
button.icon-btn:hover:not(:disabled) {
  background: var(--panel-2); border-color: var(--border);
  box-shadow: var(--shadow-sm); transform: scale(1.05);
}
button.icon-btn:active:not(:disabled) { transform: scale(0.95); }
button.icon-btn.primary {
  background: transparent; border: 1.5px solid var(--accent); color: var(--accent);
}
button.icon-btn.primary:hover:not(:disabled) {
  background: var(--accent); color: #fff; box-shadow: 0 4px 16px var(--accent-glow);
}
button.icon-btn.danger { border: 1.5px solid transparent; color: var(--red); }
button.icon-btn.danger:hover:not(:disabled) {
  background: var(--red-bg); border-color: var(--red); box-shadow: 0 0 0 3px var(--red-bg);
}
button.icon-btn svg { width: 18px; height: 18px; }

/* shared layout */
.hero { text-align: center; max-width: 560px; }
.hero .logo { font-size: 40px; margin-bottom: 12px; }
.hero h1 { font-size: 24px; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.3px; }
.hero p { color: var(--muted); font-size: 15px; }

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* modals */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  animation: fadeIn .2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.overlay[hidden] { display: none; }
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  width: min(680px, 92vw); max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn .25s var(--ease-out);
}
@keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal .modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal .modal-head h2 { font-size: 15px; font-weight: 600; flex: 1; letter-spacing: -0.2px; }
.modal .close-btn {
  background: transparent; border: none; color: var(--muted); font-size: 20px;
  width: 32px; height: 32px; border-radius: var(--radius-pill); cursor: pointer; padding: 0; line-height: 1;
  transition: all .2s var(--ease); display: flex; align-items: center; justify-content: center;
}
.modal .close-btn:hover { background: var(--panel-2); color: var(--text); box-shadow: var(--shadow-sm); }

/* ===== USER MENU (shared component) ===== */
.user-menu { position: relative; }
.user-menu-btn {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 13px;
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-pill);
  cursor: pointer; color: var(--text-2); white-space: nowrap; width: 100%;
  transition: all .2s var(--ease);
}
.user-menu-btn:hover { border-color: var(--accent); background: var(--accent-bg); box-shadow: var(--ring); }
.user-menu-btn .avatar-sm {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent-bg); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600;
  flex-shrink: 0;
}
.user-menu-btn .um-name { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.user-menu-btn .um-chevron { color: var(--muted); flex-shrink: 0; transition: transform .2s var(--ease); }
.user-dropdown {
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; width: 100%;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); display: none; flex-direction: column; z-index: 60;
  padding: 6px;
  animation: dropdownIn .2s var(--ease-out);
}
@keyframes dropdownIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.user-dropdown.open { display: flex; }
.user-dropdown .ud-item {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; color: var(--text); transition: all .15s var(--ease);
}
.user-dropdown .ud-item:hover { background: var(--panel-2); padding-left: 16px; }
.user-dropdown .ud-sep { height: 1px; background: var(--border); margin: 4px 0; }
.user-dropdown .ud-item.danger { color: var(--red); }
.user-dropdown .ud-item.danger:hover { background: var(--red-bg); }
.user-dropdown .ud-item .ud-icon { width: 16px; text-align: center; flex-shrink: 0; }
.user-dropdown .ud-header { padding: 8px 12px; font-size: 12px; color: var(--muted); }
.user-dropdown .ud-header strong { color: var(--text); font-size: 13px; }
