/* ==========================================================================
   CRAFT Web Labeler — Shared Foundation
   Common variables, reset, body base, toast, and scrollbar styles
   shared across all pages (labeling, projects, login).
   ========================================================================== */

/* ============================================================
   THEME: Focus-first labeling workspace
   - Dark canvas area so images stand out
   - Muted chrome so UI never competes with content
   - Single accent colour (blue-500) for active / primary states
   ============================================================ */

:root {
  /* surface */
  --bg-app:       #1e1e2e;
  --bg-panel:     #262637;
  --bg-panel-alt: #2e2e42;
  --bg-canvas:    #1a1a2a;
  --bg-input:     #2e2e42;
  --bg-hover:     #35354d;

  /* borders */
  --border:       #3a3a52;
  --border-light: #444460;

  /* text */
  --text-primary:   #e2e2ef;
  --text-secondary: #9494b0;
  --text-muted:     #6e6e8a;

  /* accent */
  --accent:       #6c8cff;
  --accent-hover: #5a78e6;
  --accent-subtle:#3d4a6e;

  /* semantic */
  --success:      #4ade80;
  --danger:       #f87171;
  --warning:      #fbbf24;

  /* radius */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;

  /* Shadows */
  --shadow-sm:  0 4px 20px rgba(0,0,0,.25);
  --shadow-lg:  0 20px 60px rgba(0,0,0,.5);

  /* Transitions */
  --transition-fast: .15s ease;

  /* Focus ring */
  --focus-ring: 0 0 0 2px rgba(108,140,255,.15);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
}

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  padding: 10px 20px;
  border-radius: var(--r-md);
  color: #fff;
  font-weight: 500;
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(16px);
  transition: all .25s;
  z-index: 1001;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--success); color: #111; }
.toast.error { background: var(--danger); }

/* ── Scrollbar (webkit) ─────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================
   Shared Components — Button System
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--r-md);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    transition: background var(--transition-fast),
                color var(--transition-fast),
                border-color var(--transition-fast);
    white-space: nowrap;
}
.btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}
.btn:active { transform: scale(0.97); }

/* Variants */
.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-secondary:hover {
    background: var(--border);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover {
    background: #e05252;
    border-color: #e05252;
}

.topbar .btn-danger {
    color: var(--danger);
    background: transparent;
    border-color: rgba(248, 113, 113, 0.4);
}
.topbar .btn-danger:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(248, 113, 113, 0.12);
}

.btn-ghost {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 4px;
}
.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.btn-ghost.danger:hover {
    color: var(--danger);
    background: rgba(248,113,113,.1);
}

/* Sizes */
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-xs { padding: 4px; font-size: 0.78rem; }
.btn-block { width: 100%; justify-content: center; }

/* ============================================
   Shared Components — Form Inputs
   ============================================ */

.form-input {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast);
    box-sizing: border-box;
}
.form-input:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}
.form-input-sm {
    padding: 3px 6px;
    font-size: 0.78rem;
}

/* ============================================
   Shared Components — Modals
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.25rem;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    box-sizing: border-box;
}

.modal-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.6rem 0;
}

.modal-body {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0 0 0.75rem 0;
}

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

/* ============================================
   Shared Components — Cards
   ============================================ */

.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-sizing: border-box;
}
