/* ============================================================
   SwingAI — Stylesheet
   ============================================================ */

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

:root {
  --bg-base:        #080810;
  --bg-surface:     #0f0f1a;
  --bg-card:        #13131f;
  --bg-card-hover:  #191928;
  --border:         #1e1e32;
  --border-light:   #2a2a42;
  --accent:         #818cf8;
  --accent-dim:     rgba(129, 140, 248, 0.14);
  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;
  --success:        #34d399;
  --warning:        #fbbf24;
  --danger:         #f87171;
  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 8px 32px rgba(0, 0, 0, 0.5);
  --font:           'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ─── Color helpers ─────────────────────────── */
.text-light  { color: var(--text-primary); }
.text-accent { color: var(--accent); }

/* ─── Views ─────────────────────────────────── */
.view {
  display: none;
  min-height: 100vh;
}
.view.active {
  display: flex;
  flex-direction: column;
}

/* ─── Locked View ───────────────────────────── */
#locked-view {
  position: relative;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Animated aurora blobs */
.locked-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.3;
}
.blob-1 {
  width: 620px;
  height: 620px;
  background: radial-gradient(circle, #6366f1, transparent 70%);
  top: -160px;
  left: -120px;
  animation: drift1 14s ease-in-out infinite alternate;
}
.blob-2 {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, #8b5cf6, transparent 70%);
  bottom: -120px;
  right: -120px;
  animation: drift2 18s ease-in-out infinite alternate;
}
.blob-3 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, #06b6d4, transparent 70%);
  top: 50%;
  left: 50%;
  animation: drift3 11s ease-in-out infinite alternate;
}

@keyframes drift1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(50px, 40px) scale(1.06); }
}
@keyframes drift2 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-40px, -30px) scale(1.04); }
}
@keyframes drift3 {
  from { transform: translate(-50%, -50%) scale(1); }
  to   { transform: translate(calc(-50% + 30px), calc(-50% + 20px)) scale(1.08); }
}

.locked-center {
  position: relative;
  z-index: 1;
  text-align: center;
  user-select: none;
}

.locked-logo {
  font-size: clamp(3.5rem, 12vw, 8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 1rem;
}

.locked-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Lock icon button (subtle, bottom-right) */
.auth-trigger {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 10;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s, opacity 0.2s;
  opacity: 0.25;
}
.auth-trigger:hover {
  color: var(--accent);
  border-color: var(--accent);
  opacity: 1;
}
.auth-trigger svg {
  width: 17px;
  height: 17px;
}

/* ─── Auth Dialog ───────────────────────────── */
.auth-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-dialog.hidden {
  display: none;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.auth-box {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 2.5rem 2rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
  animation: pop-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.auth-close:hover {
  color: var(--text-primary);
  background: var(--border);
}
.auth-close svg {
  width: 15px;
  height: 15px;
}

.auth-logo {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}
.auth-title {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-bottom: 1.75rem;
}

.input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.auth-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.auth-input::placeholder {
  color: var(--text-muted);
}

.auth-submit {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
}
.auth-submit:hover  { background: #6366f1; }
.auth-submit:active { transform: scale(0.95); }
.auth-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-submit svg {
  width: 18px;
  height: 18px;
}

.auth-error {
  margin-top: 0.65rem;
  font-size: 0.82rem;
  color: var(--danger);
}
.auth-error.hidden { display: none; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

/* ─── Dashboard Header ──────────────────────── */
#dashboard-view {
  background: var(--bg-base);
}

.dashboard-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(8, 8, 16, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  height: 64px;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.header-logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.header-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.2rem 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.header-greeting {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.btn-logout {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}
.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
}
.btn-logout svg {
  width: 16px;
  height: 16px;
}

/* ─── Dashboard Main ────────────────────────── */
.dashboard-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}
.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.tool-count {
  font-size: 0.83rem;
  color: var(--text-muted);
}

/* ─── Tool Cards ────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--card-accent, var(--accent));
  opacity: 0;
  transition: opacity 0.2s;
}
.tool-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.tool-card:hover::before {
  opacity: 1;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}
.card-icon {
  font-size: 2rem;
  line-height: 1;
}

/* Status badges */
.card-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.card-status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.card-status.active {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.22);
}
.card-status.wip {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.22);
}
.card-status.planned {
  background: rgba(129, 140, 248, 0.12);
  color: var(--accent);
  border: 1px solid rgba(129, 140, 248, 0.22);
}

.card-name {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}
.card-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 1.25rem;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.card-category {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.2rem 0.65rem;
  white-space: nowrap;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.75rem;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.card-link:hover {
  background: var(--accent-dim);
  border-color: rgba(129, 140, 248, 0.3);
}
.card-link svg {
  width: 13px;
  height: 13px;
  transition: transform 0.15s;
}
.card-link:hover svg {
  transform: translate(1px, -1px);
}

/* ─── Dashboard Footer ──────────────────────── */
.dashboard-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  text-align: center;
}
.dashboard-footer p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ─── Responsive ────────────────────────────── */
@media (max-width: 640px) {
  .dashboard-header {
    padding: 0 1rem;
  }
  .header-tag,
  .header-greeting {
    display: none;
  }
  .dashboard-main {
    padding: 1.5rem 1rem;
  }
  .tools-grid {
    grid-template-columns: 1fr;
  }
  .auth-box {
    margin: 1rem;
    max-width: calc(100% - 2rem);
  }
}
