/* SSSS Frontend — minimal utility-first stylesheet */

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

:root {
  --bg:       #0a0a0a;
  --surface:  #161616;
  --border:   #2a2a2a;
  --text:     #e8e8e8;
  --muted:    #888;
  --accent:   #0070f3;
  --accent-h: #005bb5;
  --danger:   #e00;
  --success:  #0a0;
  --radius:   8px;
  --font:     -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono:     "SF Mono", "Fira Code", monospace;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.container { width: 100%; max-width: 900px; margin: 0 auto; padding: 0 24px; }

/* Nav */
nav { border-bottom: 1px solid var(--border); padding: 0 24px; }
nav .inner { display: flex; align-items: center; height: 56px; gap: 24px; max-width: 900px; margin: 0 auto; }
nav .brand { font-weight: 700; font-size: 18px; color: var(--text); letter-spacing: -0.5px; }
nav .spacer { flex: 1; }
nav a { color: var(--muted); font-size: 14px; }
nav a:hover { color: var(--text); text-decoration: none; }

/* Main */
main { flex: 1; padding: 40px 24px; max-width: 900px; margin: 0 auto; width: 100%; }

/* Headings */
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 24px; }
h2 { font-size: 20px; font-weight: 600; margin-bottom: 16px; }

/* Card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.card + .card { margin-top: 16px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: var(--radius); font-size: 14px; font-weight: 500; border: none; cursor: pointer; transition: background 0.15s; text-decoration: none; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: var(--accent-h); text-decoration: none; }
.btn-outline  { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover  { background: var(--surface); text-decoration: none; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover   { background: #b00; text-decoration: none; }
.btn-github   { background: #24292e; color: #fff; width: 100%; justify-content: center; }
.btn-github:hover   { background: #1a1e22; text-decoration: none; }
.btn-google   { background: #fff; color: #333; border: 1px solid #ddd; width: 100%; justify-content: center; }
.btn-google:hover   { background: #f8f8f8; text-decoration: none; }

/* Forms */
.form-group { margin-bottom: 20px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
input[type="text"], input[type="email"], select, textarea {
  width: 100%; padding: 10px 14px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 14px; font-family: var(--font);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 80px; resize: vertical; }
select { appearance: none; cursor: pointer; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-free { background: var(--border); color: var(--muted); }
.badge-pro  { background: #1a3a6a; color: #6ab0ff; }
.badge-team { background: #1a3a1a; color: #6aff6a; }
.badge-public  { background: #1a3a1a; color: #6aff6a; }
.badge-private { background: var(--border); color: var(--muted); }
.badge-link    { background: #2a2a1a; color: #ffdd6a; }

/* Code */
code { font-family: var(--mono); font-size: 13px; background: var(--border); padding: 2px 6px; border-radius: 4px; }
.code-block { font-family: var(--mono); font-size: 13px; background: #000; padding: 16px; border-radius: var(--radius); overflow-x: auto; }

/* Login page */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 80vh; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 48px 40px; width: 100%; max-width: 380px; text-align: center; }
.login-card h1 { font-size: 24px; margin-bottom: 8px; }
.login-card .subtitle { color: var(--muted); font-size: 14px; margin-bottom: 32px; }
.auth-buttons { display: flex; flex-direction: column; gap: 12px; }

/* Section header */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-header h1, .section-header h2 { margin-bottom: 0; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 0; color: var(--muted); }
.empty-state p { margin-bottom: 20px; }

/* Loading */
.loading { color: var(--muted); padding: 40px 0; text-align: center; font-size: 14px; }

/* Error */
.error { color: #ff6b6b; padding: 12px 16px; background: rgba(224,0,0,0.1); border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }

/* Monospace URL display */
.url-display { display: flex; align-items: center; gap: 8px; }
.url-display code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab { padding: 10px 16px; font-size: 14px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; transition: color 0.15s; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab:hover:not(.active) { color: var(--text); }

/* Drag & drop deploy zone */
.dropzone {
  margin-top: 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.dragover { border-color: var(--accent); background: rgba(0, 112, 243, 0.08); }
.dz-inner { padding: 32px; }
.dz-icon { font-size: 48px; margin-bottom: 12px; }
.dz-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; }

/* Misc */
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.text-muted { color: var(--muted); font-size: 14px; }

/* Upload progress: spinner + busy state (blocks further drops) */
@keyframes ssss-spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block; width: 22px; height: 22px;
  border: 3px solid rgba(120,140,200,0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ssss-spin 0.8s linear infinite;
}
.spinner.lg { width: 44px; height: 44px; border-width: 4px; }

/* Toast notification (upload result etc.) */
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 2000;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  display: flex; align-items: flex-start; gap: 12px;
  max-width: 380px; cursor: pointer;
  animation: toast-in 0.18s ease;
}
.toast:hover { border-color: var(--accent); }
.toast-msg { flex: 1; font-size: 14px; line-height: 1.6; }
.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 20px; line-height: 1;
  padding: 0; flex-shrink: 0;
}
.toast-close:hover { color: var(--text); }
.deploying {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 24px; margin-top: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 16px; font-weight: 600;
}
/* While a deploy is in flight, dim + disable the drop zones so no extra files
   get dropped and it's obvious work is in progress. */
.dropzones.busy { opacity: 0.4; pointer-events: none; filter: grayscale(0.35); }

/* Re-sign-in prompt shown on a deploy error */
.reauth { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.reauth .links { display: flex; gap: 12px; flex-wrap: wrap; }

/* Delete controls */
.btn-danger { background: #c0303f; color: #fff; border-color: #c0303f; }
.btn-danger:hover { background: #d83a4a; border-color: #d83a4a; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.file-list { list-style: none; padding: 0; margin: 8px 0 0; }
.danger-zone { border-color: #5a2330; }

/* Segmented toggle (e.g. 月額 / 年額) — clearer than a dropdown */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.seg button { background: transparent; color: var(--muted); border: none; padding: 8px 18px; cursor: pointer; font-size: 14px; font-weight: 500; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--accent); color: #fff; }
.seg button:not(.active):hover:not(:disabled) { background: var(--surface); color: var(--text); }
.seg button:disabled { opacity: 0.4; cursor: not-allowed; }
textarea:disabled, input:disabled { opacity: 0.45; cursor: not-allowed; }

/* Plan cards: equal height (grid) with the CTA pinned to the bottom, so the two
   upgrade buttons line up regardless of differing feature-list heights. */
.grid-2 .plan-card { margin-top: 0; display: flex; flex-direction: column; }
.plan-card .btn { margin-top: auto; }

/* Copyable code box with a small Copy button in the top-right corner */
.copy-box { position: relative; }
.copy-box .code-block { padding-top: 40px; }
/* Copy button: a light blue so it stands out against the dark code box. */
/* Inline API-key name edit field — compact, fits the table cell. */
.key-name-edit { width: auto; max-width: 220px; margin: 0; padding: 6px 10px; font-size: 14px; }

.copy-btn { position: absolute; top: 8px; right: 8px; background: #cfe3ff; color: #0b3d91; border: 1px solid #9cc3ff; font-weight: 600; }
.copy-btn:hover { background: #b9d6ff; color: #0b3d91; text-decoration: none; }
