/* ────────────────────────────────────────────────────────────
   Busy-Tool – Global Stylesheet
   Dark mode first; optimised for 24" monitor dashboards
──────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --bg:           #111217;
  --surface:      #1a1c24;
  --surface-2:    #22252e;
  --border:       rgba(255,255,255,0.08);
  --accent:       #6366f1;
  --accent-hover: #4f46e5;

  --tile-red:     #9b1c1c;
  --tile-gray:    #2d2d3d;
  --tile-yellow:  #78490a;
  --tile-green:   #14532d;

  --text-primary: #f1f5f9;
  --text-muted:   #94a3b8;
  --text-dim:     #475569;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
}

html, body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Login Page ─────────────────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99,102,241,.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(34,197,94,.08) 0%, transparent 60%),
    var(--bg);
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.5s ease;
}

.login-logo {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: var(--accent);
}
.login-logo svg { width: 36px; height: 36px; }
.status-dot-green { fill: #22c55e; }

.login-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  line-height: 1.6;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-google {
  width: 100%;
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
  font-size: 0.95rem;
}
.btn-google:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

/* ── Alert ────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 20px;
  text-align: left;
}
.alert-error {
  background: rgba(220,38,38,0.12);
  border: 1px solid rgba(220,38,38,0.3);
  color: #fca5a5;
}

/* ── Self-Service Page ────────────────────────────────────────────────── */
.selfservice-page {
  background:
    radial-gradient(ellipse at top left, rgba(99,102,241,.07) 0%, transparent 50%),
    var(--bg);
}

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

.header-user {
  display: flex; align-items: center; gap: 12px;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
}
.user-name {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.btn-logout {
  font-size: 0.8rem;
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}
.btn-logout:hover {
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.2);
}

.selfservice-main {
  max-width: 600px;
  margin: 40px auto;
  padding: 0 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.section-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* Own Status Tile */
.own-status-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: border-color 0.4s ease;
}
.status-indicator {
  width: 20px; height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #4b5563;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}
.status-indicator.red    { background: #ef4444; box-shadow: 0 0 14px rgba(239,68,68,.5); }
.status-indicator.gray   { background: #6b7280; }
.status-indicator.yellow { background: #eab308; box-shadow: 0 0 14px rgba(234,179,8,.5); }
.status-indicator.green  { background: #22c55e; box-shadow: 0 0 14px rgba(34,197,94,.5); }

.status-info { flex: 1; }
.status-label {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.status-detail {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-style: italic;
}

/* Override Card */
.override-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px 0;
  overflow: hidden;
}
.override-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.override-row:last-child { border-bottom: none; }

/* Toggle */
.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
}
.toggle-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.toggle-switch {
  position: relative;
  width: 52px; height: 28px;
}
.toggle-switch input {
  opacity: 0; width: 0; height: 0; position: absolute;
}
.slider {
  position: absolute; inset: 0;
  background: #374151;
  border-radius: 99px;
  transition: background 0.25s ease;
  cursor: pointer;
}
.slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  top: 4px; left: 4px;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.toggle-switch input:checked + .slider { background: #ef4444; }
.toggle-switch input:checked + .slider::before { transform: translateX(24px); }

/* Duration Row */
.duration-row {
  flex-wrap: wrap;
  gap: 10px;
}
.field-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}
.select-input {
  flex: 1;
  min-width: 160px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 8px 12px;
  appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
.select-input:focus { border-color: var(--accent); }

.btn-apply {
  background: var(--accent);
  color: #fff;
  padding: 8px 20px;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
}
.btn-apply:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.expiry-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.expiry-hint strong { color: #fbbf24; }

/* ── Animations ──────────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-card, .selfservice-main > * {
  animation: fadeInUp 0.4s ease both;
}
.selfservice-main > *:nth-child(2) { animation-delay: 0.08s; }
