/* === RESET & BASE — Mobile First === */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #080d1a; color: #e2e8f0; min-height: 100vh; overflow-x: hidden; }
body::before { content: ''; position: fixed; inset: 0; background: radial-gradient(ellipse at 20% 0%, rgba(99,102,241,.08) 0%, transparent 50%), radial-gradient(ellipse at 80% 100%, rgba(139,92,246,.06) 0%, transparent 50%); pointer-events: none; z-index: 0; }
a { color: #818cf8; text-decoration: none; transition: color .2s; }
a:hover { color: #a5b4fc; text-decoration: none; }
::selection { background: rgba(99,102,241,.3); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* === LOGIN === */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; position: relative; z-index: 1; }
.login-box { background: rgba(15,23,42,.8); backdrop-filter: blur(20px); padding: 2rem; border-radius: 16px; width: 400px; max-width: 100%; border: 1px solid rgba(99,102,241,.2); box-shadow: 0 25px 60px rgba(0,0,0,.4), 0 0 40px rgba(99,102,241,.05); }
.login-box h1 { font-size: 1.3rem; margin-bottom: 1.25rem; text-align: center; color: #f1f5f9; letter-spacing: -.02em; }
.login-box .subtitle { text-align: center; color: #64748b; margin: -1rem 0 1.25rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }

/* === FORMS === */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: .35rem; font-size: .8rem; color: #94a3b8; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: .6rem .8rem; border: 1px solid rgba(51,65,85,.6); border-radius: 10px;
    background: rgba(15,23,42,.6); color: #e2e8f0; font-size: .9rem; outline: none;
    transition: border-color .2s, box-shadow .2s; backdrop-filter: blur(4px);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.form-group textarea { resize: vertical; min-height: 80px; }

/* === BUTTONS === */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem; border: none; border-radius: 10px; font-size: .85rem; cursor: pointer; transition: all .2s; font-weight: 600; letter-spacing: -.01em; position: relative; overflow: hidden; }
.btn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,.1), transparent); opacity: 0; transition: opacity .2s; }
.btn:hover::after { opacity: 1; }
.btn-primary { background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; box-shadow: 0 2px 8px rgba(99,102,241,.3); }
.btn-primary:hover { background: linear-gradient(135deg, #818cf8, #6366f1); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,.4); }
.btn-success { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; box-shadow: 0 2px 8px rgba(34,197,94,.25); }
.btn-success:hover { background: linear-gradient(135deg, #4ade80, #22c55e); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; box-shadow: 0 2px 8px rgba(239,68,68,.25); }
.btn-danger:hover { background: linear-gradient(135deg, #f87171, #ef4444); }
.btn-sm { padding: .35rem .7rem; font-size: .75rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* === ALERTS === */
.alert { padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: .85rem; border: 1px solid; backdrop-filter: blur(4px); }
.alert-error { background: rgba(127,29,29,.4); color: #fca5a5; border-color: rgba(239,68,68,.2); }
.alert-success { background: rgba(20,83,45,.4); color: #86efac; border-color: rgba(34,197,94,.2); }

/* === LAYOUT === */
.app-layout { display: flex; flex-direction: column; min-height: 100vh; position: relative; z-index: 1; }

/* --- Sidebar (mobile: top bar + slide-out) --- */
.sidebar { width: 100%; background: rgba(15,23,42,.95); backdrop-filter: blur(20px); padding: 0; flex-shrink: 0; border-bottom: 1px solid rgba(99,102,241,.15); position: sticky; top: 0; z-index: 100; }
.sidebar h2 { display: inline-block; padding: .75rem 1rem; font-size: 1rem; color: #f1f5f9; border-bottom: none; margin-bottom: 0; background: linear-gradient(135deg, #818cf8, #6366f1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; font-weight: 700; letter-spacing: -.02em; }
.sidebar .user-info { display: inline-block; padding: .5rem 1rem; font-size: .7rem; color: #64748b; border-bottom: none; margin-bottom: 0; }
.sidebar nav { display: none; flex-direction: column; padding: .5rem 0; background: rgba(15,23,42,.98); border-top: 1px solid rgba(51,65,85,.5); }
.sidebar nav.open { display: flex; }
.sidebar nav a { display: flex; align-items: center; gap: .5rem; padding: .65rem 1.25rem; color: #94a3b8; font-size: .85rem; transition: all .2s; border-left: 3px solid transparent; }
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(99,102,241,.08); color: #e2e8f0; text-decoration: none; border-left-color: #6366f1; }
.sidebar nav a.active { color: #818cf8; font-weight: 600; }

/* Mobile hamburger */
.mobile-menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; background: none; border: 1px solid #334155; border-radius: 8px; color: #e2e8f0; font-size: 1.2rem; cursor: pointer; position: absolute; right: 1rem; top: .55rem; transition: all .2s; }
.mobile-menu-btn:hover { border-color: #6366f1; background: rgba(99,102,241,.1); }

.nav-group { margin: 0; }
.nav-group-toggle { font-weight: 600; cursor: pointer; }
.nav-group-toggle::after { content: ' ▸'; font-size: .7rem; }
.nav-group.open .nav-group-toggle::after { content: ' ▾'; }
.nav-group-items { display: none; }
.nav-group.open .nav-group-items { display: flex; flex-direction: column; }
.nav-group-items a { padding-left: 2.5rem !important; font-size: .8rem !important; }

/* Main content */
.main-content { flex: 1; padding: 1rem; overflow-x: auto; position: relative; }
.main-content h2 { font-size: 1.2rem; margin-bottom: 1rem; color: #f1f5f9; font-weight: 700; letter-spacing: -.02em; }

/* === CARDS === */
.card { background: rgba(15,23,42,.6); backdrop-filter: blur(12px); border-radius: 14px; padding: 1.25rem; margin-bottom: 1.25rem; border: 1px solid rgba(51,65,85,.5); transition: border-color .2s; }
.card:hover { border-color: rgba(99,102,241,.2); }
.card h3 { font-size: 1rem; margin-bottom: .85rem; color: #f1f5f9; font-weight: 600; }

/* === TABLE === */
table { width: 100%; border-collapse: collapse; }
th, td { padding: .55rem .65rem; text-align: left; border-bottom: 1px solid rgba(51,65,85,.4); font-size: .8rem; }
th { color: #64748b; font-weight: 600; text-transform: uppercase; font-size: .65rem; letter-spacing: .06em; white-space: nowrap; }
td { color: #cbd5e1; }
tr { transition: background .15s; }
tr:hover td { background: rgba(99,102,241,.04); }

/* Responsive tables — auto scroll on mobile */
.card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -.5rem; padding: 0 .5rem; }

/* === BADGES === */
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 9999px; font-size: .7rem; font-weight: 600; letter-spacing: .02em; }
.badge-green { background: rgba(34,197,94,.15); color: #4ade80; border: 1px solid rgba(34,197,94,.2); }
.badge-red { background: rgba(239,68,68,.15); color: #f87171; border: 1px solid rgba(239,68,68,.2); }
.badge-blue { background: rgba(99,102,241,.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,.2); }
.badge-yellow { background: rgba(234,179,8,.15); color: #fde047; border: 1px solid rgba(234,179,8,.2); }
.badge-gray { background: rgba(51,65,85,.4); color: #94a3b8; border: 1px solid rgba(51,65,85,.5); }

/* === CHECKBOXES === */
.checkbox-grid { display: grid; grid-template-columns: 1fr; gap: .4rem; margin: .75rem 0; }
.checkbox-item { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; background: rgba(15,23,42,.5); border: 1px solid rgba(51,65,85,.5); border-radius: 10px; cursor: pointer; transition: all .2s; backdrop-filter: blur(4px); }
.checkbox-item:hover { border-color: rgba(99,102,241,.4); }
.checkbox-item.selected { border-color: #6366f1; background: rgba(99,102,241,.1); }
.checkbox-item input[type="checkbox"] { accent-color: #6366f1; }
.checkbox-item .account-name { font-weight: 500; color: #e2e8f0; font-size: .85rem; }
.checkbox-item .account-info { font-size: .7rem; color: #64748b; }

/* === TRAINING CARDS — web3 === */
.training-card { position: relative; padding: .65rem .85rem !important; background: linear-gradient(135deg, rgba(15,23,42,.9), rgba(30,41,59,.7)) !important; border: 1px solid rgba(99,102,241,.2) !important; border-radius: 12px !important; backdrop-filter: blur(8px); transition: all .2s ease !important; overflow: hidden; }
.training-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, #6366f1, #8b5cf6, #a78bfa); opacity: 0; transition: opacity .2s; }
.training-card:hover { border-color: rgba(99,102,241,.5) !important; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,.15); }
.training-card:hover::before { opacity: 1; }
.training-card.selected { border-color: #6366f1 !important; background: linear-gradient(135deg, rgba(30,27,75,.8), rgba(49,46,129,.4)) !important; box-shadow: 0 0 20px rgba(99,102,241,.2), inset 0 0 20px rgba(99,102,241,.05); }
.training-card.selected::before { opacity: 1; }
.training-card.busy { opacity: .35; pointer-events: none; }
.training-card-body { display: flex; flex-direction: column; gap: 2px; }
.training-card-body .account-name { font-weight: 600; font-size: .9rem; letter-spacing: -.01em; }
.training-card-meta { display: flex; gap: .5rem; align-items: center; }
.training-card-id { font-size: .7rem; color: #64748b; font-family: monospace; }
.training-card-warm { font-size: .7rem; font-weight: 600; color: #f97316; background: rgba(249,115,22,.1); padding: 0 6px; border-radius: 4px; border: 1px solid rgba(249,115,22,.15); }
.training-card-cold { font-size: .7rem; color: #475569; }

/* === TASK TYPES === */
.task-types { display: flex; gap: .5rem; flex-wrap: wrap; margin: .75rem 0; }
.task-type { display: flex; align-items: center; gap: .35rem; padding: .45rem .85rem; border: 1px solid rgba(51,65,85,.5); border-radius: 10px; cursor: pointer; transition: all .2s; font-size: .85rem; background: rgba(15,23,42,.4); }
.task-type:hover { border-color: rgba(99,102,241,.4); }
.task-type.active { border-color: #6366f1; background: rgba(99,102,241,.1); box-shadow: 0 0 12px rgba(99,102,241,.1); }
.task-type input { display: none; }

/* === TOGGLE === */
.toggle-wrap { display: flex; align-items: center; gap: .75rem; margin: .75rem 0; }
.toggle { position: relative; width: 44px; height: 24px; background: #334155; border-radius: 12px; cursor: pointer; transition: background .2s; }
.toggle.on { background: #6366f1; box-shadow: 0 0 12px rgba(99,102,241,.3); }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: left .2s; }
.toggle.on::after { left: 22px; }

.flex-row { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }

/* === MODAL === */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.modal { background: rgba(15,23,42,.95); backdrop-filter: blur(20px); border-radius: 16px; padding: 1.5rem; width: 500px; max-width: 100%; max-height: 90vh; overflow-y: auto; border: 1px solid rgba(99,102,241,.2); box-shadow: 0 25px 60px rgba(0,0,0,.5); }
.modal h3 { margin-bottom: 1.25rem; font-size: 1.1rem; }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; }

/* === SPINNER === */
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(99,102,241,.2); border-top-color: #818cf8; border-radius: 50%; animation: spin .6s linear infinite; vertical-align: middle; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* === WARMUP ACTIVITY PILLS === */
.act-pill { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; background: rgba(15,23,42,.5); border: 1px solid rgba(51,65,85,.5); border-radius: 6px; cursor: pointer; font-size: .7rem; color: #94a3b8; transition: all .15s; user-select: none; }
.act-pill:hover { border-color: rgba(99,102,241,.4); }
.act-pill input:checked + span, .act-pill:has(input:checked) { color: #e2e8f0; }
.act-pill:has(input:checked) { border-color: #6366f1; background: rgba(99,102,241,.1); }
.act-pill input[type="checkbox"] { accent-color: #6366f1; width: 12px; height: 12px; }
.warmup-now-row { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem; background: rgba(15,23,42,.5); border: 1px solid rgba(51,65,85,.5); border-radius: 10px; margin-bottom: .4rem; flex-wrap: wrap; transition: all .2s; }
.warmup-now-row:hover { border-color: rgba(99,102,241,.4); }
.warmup-now-row.selected { border-color: #6366f1; background: rgba(99,102,241,.1); }
.warmup-now-row .account-check { accent-color: #6366f1; }
.warmup-now-row .account-name { font-weight: 500; color: #e2e8f0; min-width: 100px; font-size: .85rem; }
.warmup-now-row .acts { display: flex; gap: .3rem; flex-wrap: wrap; margin-left: auto; }

/* ============================
   TABLET (≥640px)
   ============================ */
@media (min-width: 640px) {
    .checkbox-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .main-content { padding: 1.25rem; }
    .card { padding: 1.5rem; }
    th, td { padding: .6rem .8rem; font-size: .85rem; }
    th { font-size: .7rem; }
}

/* ============================
   DESKTOP (≥1024px)
   ============================ */
@media (min-width: 1024px) {
    .app-layout { flex-direction: row; }

    .sidebar { width: 230px; border-bottom: none; border-right: 1px solid rgba(99,102,241,.1); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
    .sidebar h2 { display: block; padding: .85rem 1.25rem .65rem; font-size: 1.05rem; border-bottom: 1px solid rgba(51,65,85,.4); margin-bottom: .5rem; }
    .sidebar .user-info { display: block; padding: .4rem 1.25rem .6rem; border-bottom: 1px solid rgba(51,65,85,.4); margin-bottom: .5rem; }
    .sidebar nav { display: flex !important; }
    .mobile-menu-btn { display: none; }
    .nav-group-items { flex-direction: column; }

    .main-content { padding: 2rem; }
    .main-content h2 { font-size: 1.4rem; margin-bottom: 1.5rem; }
    .checkbox-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .5rem; }
}

/* ============================
   WIDE DESKTOP (≥1400px)
   ============================ */
@media (min-width: 1400px) {
    .sidebar { width: 260px; }
    .main-content { padding: 2.5rem; }
    .checkbox-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
