/* ════════════════════════════════════════
   Steam Farming Panel — Main Stylesheet
   ════════════════════════════════════════ */

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

:root {
  --bg:          #0d1117;
  --surface:     #161b22;
  --card:        #1c2230;
  --border:      #30363d;
  --text:        #e6edf3;
  --muted:       #8b949e;
  --accent:      #3fb950;
  --accent-dim:  #1b4332;
  --accent-glow: rgba(63, 185, 80, 0.25);
  --red:         #f85149;
  --red-dim:     #3d1f1e;
  --blue:        #58a6ff;
  --yellow:      #d29922;
  --sidebar-w:   220px;
  --radius:      10px;
  --transition:  0.2s ease;
}

html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

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

/* ── Utilities ──────────────────────────────────── */
.hidden { display: none !important; }
.mt-8  { margin-top: 8px; }

/* ════════════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, #0e3d20 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, #0b2d38 0%, transparent 50%);
}

.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  animation: float 8s ease-in-out infinite alternate;
}
.b1 { width: 400px; height: 400px; background: #1b9c56; top: -100px; left: -100px; animation-delay: 0s; }
.b2 { width: 300px; height: 300px; background: #0e6e3a; bottom: -80px; right: 10%; animation-delay: 2s; }
.b3 { width: 250px; height: 250px; background: #155e30; top: 40%; right: -50px; animation-delay: 4s; }

@keyframes float {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(20px, 30px) scale(1.05); }
}

.login-card {
  position: relative;
  z-index: 1;
  background: rgba(22, 27, 34, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.login-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-sub   { color: var(--muted); margin-bottom: 28px; }

.login-lang {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 12px;
}

.guard-notice {
  background: rgba(210, 153, 34, 0.12);
  border: 1px solid rgba(210, 153, 34, 0.3);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--yellow);
  font-size: 13px;
  margin-bottom: 12px;
}

/* ════════════════════════════════════════
   APP LAYOUT
   ════════════════════════════════════════ */
#app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  font-size: 16px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
}

.sidebar-username {
  display: block;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-item:hover { background: rgba(63, 185, 80, 0.08); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }

.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-bottom {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}
.btn-logout svg { width: 17px; height: 17px; }
.btn-logout:hover { background: var(--red-dim); color: var(--red); }

/* ── Main content ───────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────── */
.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.steam-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(63, 185, 80, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.green  { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.dot.red    { background: var(--red); }
.dot.yellow { background: var(--yellow); animation: pulse-yellow 1.5s infinite; }

@keyframes pulse-yellow {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Farming status bar ─────────────────────────── */
.farm-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, rgba(63,185,80,0.12), rgba(63,185,80,0.06));
  border: 1px solid rgba(63,185,80,0.35);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin: 0 24px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  animation: bar-pulse 3s ease-in-out infinite;
}

@keyframes bar-pulse {
  0%, 100% { border-color: rgba(63,185,80,0.35); }
  50%       { border-color: rgba(63,185,80,0.65); }
}

.farm-status-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.farm-status-games {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
}

.farm-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--accent);
  animation: farming-pulse 2s ease-in-out infinite;
}

.farm-status-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
}

.farm-session-timer {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

/* ── Section ────────────────────────────────────── */
.section { padding: 0 0 24px; flex: 1; }
.section.hidden { display: none; }
.section.active { display: block; }

.section-toolbar {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.farm-controls { display: flex; gap: 8px; }
.farm-hint { color: var(--muted); font-size: 12px; margin-left: 4px; }

/* ════════════════════════════════════════
   LIBRARY GRID
   ════════════════════════════════════════ */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.game-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.game-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.game-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.game-card.farming  { border-color: var(--accent); }

.game-card-image {
  width: 100%;
  aspect-ratio: 460/215;
  object-fit: cover;
  background: #0f1824;
  display: block;
}

.game-card-body {
  padding: 10px 12px 12px;
}

.game-card-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.game-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.game-card-hours {
  font-size: 11px;
  color: var(--muted);
}

.farming-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: farming-pulse 2s ease-in-out infinite;
}

@keyframes farming-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

.game-card-select {
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(13,17,23,0.8);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.game-card.selected .game-card-select {
  background: var(--accent);
  border-color: var(--accent);
}
.game-card-select::after {
  content: '';
  width: 10px; height: 10px;
  background: white;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0);
  transition: all 0.15s ease;
}
.game-card.selected .game-card-select::after {
  opacity: 1;
  transform: scale(1);
}

.game-card-remove {
  position: absolute;
  top: 8px; left: 8px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(13,17,23,0.8);
  border: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition);
}
.game-card:hover .game-card-remove { opacity: 1; }
.game-card-remove:hover { background: var(--red-dim); border-color: var(--red); color: var(--red); }

/* ════════════════════════════════════════
   REWARDS
   ════════════════════════════════════════ */
.rewards-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

.rewards-tracking-panel,
.rewards-log-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.tracking-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(48,54,61,0.5);
  font-size: 13px;
}
.tracking-item:last-child { border-bottom: none; }
.tracking-game-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ════════════════════════════════════════
   TABLE
   ════════════════════════════════════════ */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(48,54,61,0.4);
  font-size: 13px;
}
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ════════════════════════════════════════
   SETTINGS
   ════════════════════════════════════════ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.settings-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.lang-choice-group {
  display: flex;
  gap: 12px;
}

.lang-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex: 1;
  transition: all var(--transition);
  font-size: 13px;
}
.lang-choice:hover { border-color: var(--accent); }
.lang-choice input[type="radio"] { accent-color: var(--accent); }
.lc-flag { font-size: 20px; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.toggle-label { font-size: 13px; color: var(--text); }

.toggle { position: relative; width: 42px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: background var(--transition);
}
.slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  left: 3px; top: 3px;
  transition: transform var(--transition);
}
.toggle input:checked + .slider { background: var(--accent); }
.toggle input:checked + .slider::before { transform: translateX(20px); }

.settings-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.save-confirmation {
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}

/* ════════════════════════════════════════
   FORMS & BUTTONS
   ════════════════════════════════════════ */
.field-group { margin-bottom: 14px; }
.field-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.field-group input,
.field-group select,
.field-group textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.field-group input:focus,
.field-group select:focus { border-color: var(--accent); }
.field-group select option { background: var(--card); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #0d1117;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}
.btn-primary:hover { background: #52d465; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-full { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }

.btn-green {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(63, 185, 80, 0.15);
  border: 1px solid rgba(63, 185, 80, 0.4);
  color: var(--accent);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}
.btn-green:hover { background: rgba(63, 185, 80, 0.25); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: var(--red);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}
.btn-danger:hover { background: rgba(248, 81, 73, 0.2); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.lang-btn {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: color var(--transition);
}
.lang-btn.active, .lang-btn:hover { color: var(--accent); }

/* ── Error message ──────────────────────────────── */
.error-msg {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--red-dim);
  border: 1px solid rgba(248,81,73,0.3);
  border-radius: 8px;
  color: var(--red);
  font-size: 13px;
}

/* ── Empty state ────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* ════════════════════════════════════════
   MODAL
   ════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 440px;
  padding: 24px;
  animation: modal-in 0.2s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  color: var(--muted);
  font-size: 18px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.file-drop {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  transition: all var(--transition);
}
.file-drop:hover { border-color: var(--accent); color: var(--accent); }
.file-drop svg { display: block; margin: 0 auto 8px; opacity: 0.5; }
.file-drop p { font-size: 12px; }
.file-name { display: block; font-size: 11px; color: var(--accent); margin-top: 4px; }

/* ════════════════════════════════════════
   TOAST
   ════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  animation: toast-in 0.25s ease;
  max-width: 360px;
  text-align: center;
}
.toast.success { border-color: rgba(63,185,80,0.4); color: var(--accent); }
.toast.error   { border-color: rgba(248,81,73,0.4); color: var(--red); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Section subtitle ───────────────────────────── */
.section-subtitle { font-size: 14px; font-weight: 600; color: var(--text); }

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */
@media (max-width: 900px) {
  .rewards-layout { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-220px); }
  .main-content { margin-left: 0; }
}
