/* ============================================================ */
/* style.css — AutoActivity v1.0                               */
/* ============================================================ */

:root {
    --bg-page: #0a0e17;
    --bg-card: #1a2332;
    --bg-card-hover: #1e2a3d;
    --bg-input: #1a2332;
    --bg-nav: rgba(26, 35, 50, 0.95);
    
    --text-primary: #ffffff;
    --text-secondary: #8892b0;
    --text-muted: #4a5568;
    --text-white: #ffffff;
    
    --border-color: #1e2838;
    --border-light: #2a3a4a;
    
    --primary: #6D5DF6;
    --primary-hover: #8C7CFF;
    --primary-light: rgba(109, 93, 246, 0.15);
    --primary-glow: rgba(109, 93, 246, 0.25);
    
    --success: #22C55E;
    --success-bg: rgba(34, 197, 94, 0.15);
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.15);
    
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --radius-full: 9999px;
    
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-nav: 0 -4px 24px rgba(0, 0, 0, 0.6);
    
    --transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    
    --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 12px 12px 80px 12px;
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
    min-height: 100vh;
}

/* ===== СТРАНИЦЫ ===== */
.page {
    display: none;
    animation: fadeSlide 0.3s ease;
}
.page.active { display: block; }

@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== АВТОРИЗАЦИЯ ===== */
#page-auth.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

/* ★★★ ДОБАВЛЯЕМ ПРАВИЛО ДЛЯ СКРЫТОЙ СТРАНИЦЫ ★★★ */
#page-auth.auth-page.hidden {
    display: none !important;
}

#page-auth.auth-page .auth-screen {
    text-align: center;
    max-width: 400px;
    width: 100%;
    padding: 40px 28px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

#page-auth.auth-page .auth-icon {
    font-size: 56px;
    margin-bottom: 8px;
}

#page-auth.auth-page .auth-title {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #6D5DF6, #8C7CFF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#page-auth.auth-page .auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

#page-auth.auth-page .auth-status {
    background: var(--bg-page);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

#page-auth.auth-page .status-title {
    font-weight: 600;
    font-size: 15px;
}

#page-auth.auth-page .status-desc {
    color: var(--text-secondary);
    font-size: 13px;
}

#page-auth.auth-page .btn-auth {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    box-shadow: 0 4px 20px var(--primary-glow);
}

#page-auth.auth-page .btn-auth:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

#page-auth.auth-page .auth-features {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

#page-auth.auth-page .feature-item {
    flex: 1;
    padding: 12px 4px;
    border-radius: var(--radius-xs);
    background: var(--bg-page);
    border: 1px solid var(--border-color);
}

#page-auth.auth-page .feature-icon {
    font-size: 24px;
    display: block;
}

#page-auth.auth-page .feature-label {
    font-size: 12px;
    font-weight: 600;
    display: block;
    margin-top: 4px;
}

#page-auth.auth-page .feature-desc {
    font-size: 10px;
    color: var(--text-secondary);
}

/* ===== ХЕДЕР ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0 16px 0;
    margin-bottom: 16px;
}

.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 6px; }

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

.avatar:hover { border-color: var(--primary); transform: scale(1.05); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.greeting {
    font-size: 17px;
    font-weight: 700;
}

.greeting-sub {
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-logout {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 6px 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--bg-card);
    color: var(--text-secondary);
}

.btn-back {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 6px;
    transition: var(--transition);
}

.btn-back:hover { color: var(--text-primary); }

.btn-theme-toggle {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 50%;
    transition: var(--transition);
    color: var(--text-secondary);
}

.btn-theme-toggle:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.page-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.page-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ===== СТАТИСТИКА ===== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 16px 12px;
    text-align: center;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.stat-value {
    font-size: 22px;
    font-weight: 800;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===== КАРТОЧКИ ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px 18px;
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
    transition: var(--transition);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
}

.card-link {
    font-size: 13px;
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.card-link:hover { color: var(--primary-hover); }

/* ===== КНОПКИ ===== */
.btn-primary {
    padding: 12px 20px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    padding: 12px 20px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-danger {
    padding: 12px 20px;
    background: var(--danger);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-danger:hover { opacity: 0.85; }

.btn-sm { padding: 6px 14px; font-size: 12px; min-height: 32px; width: auto; }
.btn-block { width: 100%; }

/* ===== ТОКЕНЫ ===== */
.token-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.token-item:last-child { border-bottom: none; }

.token-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.token-info { flex: 1; min-width: 0; }
.token-name { font-weight: 600; font-size: 13px; }
.token-meta { font-size: 11px; color: var(--text-secondary); }
.token-status { font-size: 10px; font-weight: 500; padding: 1px 8px; border-radius: var(--radius-full); }

.token-status.active {
    background: var(--success-bg);
    color: var(--success);
}

.token-status.inactive {
    background: var(--danger-bg);
    color: var(--danger);
}

.token-status.running {
    background: var(--warning-bg);
    color: var(--warning);
}

/* ===== ЗАДАНИЯ ===== */
.task-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.task-item:last-child { border-bottom: none; }

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-id { font-weight: 600; font-size: 14px; }

.task-status {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: var(--radius-full);
}

.task-status.pending { background: var(--bg-input); color: var(--text-secondary); }
.task-status.running { background: var(--warning-bg); color: var(--warning); }
.task-status.completed { background: var(--success-bg); color: var(--success); }
.task-status.error { background: var(--danger-bg); color: var(--danger); }
.task-status.paused { background: var(--bg-input); color: var(--text-muted); }

.task-group { font-size: 12px; color: var(--text-secondary); }
.task-stats { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ===== МОДАЛКИ ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.25s ease;
}

.modal-overlay.hidden { display: none; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px 20px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer; }
.modal-body { padding: 16px 20px 20px 20px; }
.modal-footer { padding: 12px 20px 16px 20px; border-top: 1px solid var(--border-color); display: flex; gap: 8px; }

/* ===== ТОКЕН-МОДАЛКА ===== */
.token-instructions ol {
    margin: 10px 0 14px 18px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.8;
}

.token-instructions ol a { color: var(--primary); text-decoration: none; }

.token-input-wrap {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    margin: 10px 0;
}

.token-input-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.token-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-family: monospace;
    color: var(--text-primary);
    outline: none;
}

.token-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.token-input-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.token-preview {
    background: var(--primary-light);
    border-radius: var(--radius-xs);
    padding: 10px 14px;
    border: 1px solid var(--primary);
    margin-top: 10px;
}

.token-preview-value {
    font-size: 12px;
    font-weight: 600;
    word-break: break-all;
    font-family: monospace;
    margin-top: 2px;
}

/* ===== ФОРМА ЗАДАНИЯ ===== */
.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    font-size: 14px;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
}

.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238892b0' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-checkbox input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ===== ПРОФИЛЬ ===== */
.profile-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.profile-avatar { font-size: 56px; }
.profile-avatar img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-color); }
.profile-name { font-size: 18px; font-weight: 700; }
.profile-id { font-size: 13px; color: var(--text-secondary); }

.menu-list {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: var(--bg-input); }
.menu-icon { font-size: 18px; }
.menu-label { font-size: 14px; font-weight: 500; flex: 1; }
.menu-badge { font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: var(--radius-full); background: var(--primary-light); color: var(--primary); }
.menu-arrow { color: var(--text-muted); font-size: 14px; }

/* ===== НИЖНЯЯ НАВИГАЦИЯ ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-nav);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 4px 0 env(safe-area-inset-bottom);
    max-width: 480px;
    margin: 0 auto;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 4px 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    min-height: 44px;
    justify-content: center;
}

.nav-item .nav-icon { font-size: 20px; }
.nav-item .nav-label { font-size: 9px; font-weight: 500; }

.nav-item.active { color: var(--primary); }
.nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--primary);
    border-radius: 0 0 4px 4px;
}

/* ===== ЗАГРУЗКА ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 23, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    gap: 12px;
}

.loading-overlay.hidden { display: none; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border-color); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text-secondary); font-size: 13px; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== ТОСТЫ ===== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 16px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    max-width: 90%;
    text-align: center;
    animation: toastFade 0.3s ease;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }

@keyframes toastFade {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ===== УТИЛИТЫ ===== */
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }

/* ===== АДАПТИВ ===== */
@media (max-width: 480px) {
    body { padding: 10px 10px 72px 10px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

@media (min-width: 768px) {
    body {
        padding: 20px 20px 96px 20px;
        background: radial-gradient(ellipse at 30% 20%, #1A1A2E, #000000 70%);
    }
}