/* ================================================================ */
/* ===       WORKSHOP AI: ADMIN DASHBOARD (FINAL VERSION)        == */
/* ================================================================ */

:root {
    --glass-bg: rgba(30, 34, 45, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 12px;
    --accent-color: #3b82f6;
    --text-secondary: #9ca3af;
    --text-primary: #ffffff;
}

/* --- 1. ОСНОВНАЯ СЕТКА И КАРТОЧКИ --- */

.admin-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.admin-card {
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    transition: transform 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
}

.admin-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* --- 2. ШАПКА (HEADER) --- */

.admin-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-actions {
    display: flex;
    gap: 10px;
}

/* --- 3. НАВИГАЦИЯ (ВКЛАДКИ С ЭМОДЗИ) --- */

.admin-tabs {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 6px;
    border-radius: 14px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}

.admin-tabs::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Общий стиль кнопок навигации */
.admin-tab-btn,
.btn-support-toggle {
    width: 44px !important;
    height: 44px !important;
    display: flex;
    justify-content: center;
    align-items: center;
    
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0 !important;
    
    font-size: 22px; /* Размер эмодзи */
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

/* Эффекты кнопок вкладок */
.admin-tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.admin-tab-btn.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Кнопка поддержки (справа) */
.btn-support-toggle {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    position: relative;
    font-size: 20px;
}

.btn-support-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.5);
}

/* Бейдж уведомлений на кнопке */
.btn-support-toggle .badge-counter {
    background-color: #ef4444;
    color: white;
    font-size: 0.6rem;
    font-weight: bold;
    font-family: sans-serif;
    padding: 2px 5px;
    border-radius: 10px;
    position: absolute;
    top: -4px;
    right: -4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    border: 2px solid #1e222d;
}

/* --- 4. КОМПАКТНАЯ СТАТИСТИКА (HUD) --- */

.admin-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 в ряд на ПК */
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-item:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.stat-emoji-box {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.1;
    color: #fff;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Цвета для значений (Bootstrap-like) */
.text-success { color: #10b981 !important; }
.text-warning { color: #f59e0b !important; }
.text-info { color: #3b82f6 !important; }
.text-danger { color: #ef4444 !important; }

/* --- 5. СПИСКИ, ТАБЛИЦЫ, ГРАФИКИ --- */

.chart-wrapper {
    position: relative;
    height: 350px;
    width: 100%;
}

.list-header {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.admin-list-item:last-child { border-bottom: none; }

.user-mini-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; margin-right: 10px; }
.user-mini-text div:first-child { font-weight: 500; font-size: 0.95rem; }
.user-mini-text div:last-child { font-size: 0.75rem; color: var(--text-secondary); }

/* Таблицы (Мультиаккаунты, Промокоды) */
.table-wrapper { overflow-x: auto; } /* Горизонтальный скролл на мобиле */
.risk-table { width: 100%; border-collapse: collapse; }
.risk-table th { text-align: left; padding: 10px; color: var(--text-secondary); font-size: 0.8rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
.risk-table td { padding: 12px 10px; border-bottom: 1px solid rgba(255,255,255,0.03); vertical-align: top; }
.risk-score { display: inline-block; padding: 2px 8px; border-radius: 4px; background: rgba(239, 68, 68, 0.2); color: #fca5a5; font-weight: bold; font-size: 0.9rem; }

/* Онлайн юзеры */
.online-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.online-user-card { padding: 1rem; background-color: rgba(30, 34, 45, 0.8); }
.online-dot { position: absolute; bottom: 0; right: 0; width: 12px; height: 12px; background-color: #10b981; border: 2px solid #1e222d; border-radius: 50%; }
.admin-avatar { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; }
.admin-system-info { background: rgba(0, 0, 0, 0.2); border-radius: 8px; padding: 8px; font-size: 0.75rem; color: var(--text-secondary); }

/* --- 6. ТЕРМИНАЛ ЛОГОВ --- */

.log-viewer-card {
    background-color: #0d1117;
    border: 1px solid #30363d;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: calc(100vh - 160px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.log-toolbar {
    background: #161b22;
    border-bottom: 1px solid #30363d;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.log-select {
    background-color: #0d1117;
    color: #c9d1d9;
    border: 1px solid #30363d;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
.log-select:focus { border-color: #58a6ff; }

.log-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.05);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
}

.log-terminal-area {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #c9d1d9;
    white-space: pre-wrap;
    scrollbar-width: thin;
    scrollbar-color: #30363d #0d1117;
}

.log-terminal-area::-webkit-scrollbar { width: 10px; }
.log-terminal-area::-webkit-scrollbar-track { background: #0d1117; }
.log-terminal-area::-webkit-scrollbar-thumb { background-color: #30363d; border-radius: 5px; border: 2px solid #0d1117; }
.log-terminal-area::-webkit-scrollbar-thumb:hover { background-color: #58a6ff; }

/* Подсветка синтаксиса */
.log-date { color: #8b949e; }
.log-error { color: #f85149; font-weight: bold; }
.log-success { color: #56d364; }
.log-warning { color: #e3b341; }
.log-info { color: #58a6ff; }

/* --- ЮНИТ-ЭКОНОМИКА (ПРОГРЕСС-БАРЫ) --- */
.economy-bar-container {
    height: 8px;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    margin-top: 8px;
    margin-bottom: 4px;
}

.eco-segment {
    height: 100%;
    transition: width 0.3s ease;
}

.eco-profit { background-color: #10b981; } /* Зеленый - Прибыль */
.eco-tax { background-color: #9ca3af; }    /* Серый - Налог */
.eco-cost { background-color: #ef4444; }   /* Красный - Расходы */

.eco-legend {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.eco-value {
    font-weight: bold;
    color: #fff;
}

/* ================================================================ */
/* ===       МОБИЛЬНАЯ ВЕРСИЯ (АДАПТИВ)                          === */
/* ================================================================ */

@media (max-width: 768px) {
    
    #admin-view { padding: 10px !important; }

    /* Сетки превращаются в колонки */
    .admin-grid-container {
        grid-template-columns: 1fr !important; 
    }

    .admin-card { padding: 12px !important; border-radius: 12px !important; }

    /* Шапка */
    .admin-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 15px !important;
        padding-bottom: 10px !important;
    }

    .admin-title { font-size: 1.25rem !important; margin-bottom: 5px; }
    
    .admin-actions { width: 100%; justify-content: flex-end; }

    /* Табы (кнопки) */
    .admin-tabs { width: 100%; padding-bottom: 5px; }
    
    .admin-tab-btn, 
    .btn-support-toggle {
        width: 38px !important;
        height: 38px !important;
        font-size: 20px;
        border-radius: 8px !important;
    }

    /* Статистика (HUD): 2x2 на телефоне */
    .admin-stats-row {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }

    .stat-item {
        padding: 10px !important;
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .stat-emoji-box {
        width: 36px;
        height: 36px;
        font-size: 20px;
        background: transparent; /* Убираем фон для чистоты */
    }

    .stat-value { font-size: 1.1rem; }
    .stat-label { font-size: 0.65rem; }

    /* Списки */
    .list-header { font-size: 0.95rem !important; margin-bottom: 0.75rem !important; }
    .admin-list-item { padding: 8px 0 !important; }
    .user-mini-avatar { width: 30px !important; height: 30px !important; }
    .user-mini-text div:first-child { font-size: 0.85rem !important; }
    .user-mini-text div:last-child { font-size: 0.7rem !important; }

    .risk-table th, .risk-table td { padding: 8px 6px !important; font-size: 0.75rem !important; }
    .risk-score { padding: 1px 5px !important; font-size: 0.75rem !important; }

    /* Логи */
    .log-viewer-card { height: calc(100vh - 220px); }
    .log-toolbar { flex-direction: column; align-items: stretch; }
    .log-select { width: 100%; }
    .log-switch-wrapper { justify-content: center; }
    .btn-log-action { flex-grow: 1; }
    
    /* Графики */
    .chart-wrapper { height: 200px !important; min-height: 200px !important; }
}

/* --- СТИЛИ ДЛЯ PRO В АДМИНКЕ --- */

/* Золотая обводка аватарки */
.admin-avatar.vip-glow {
    border: 2px solid #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
    /* Можно добавить анимацию, если хочется, как в основном профиле */
    /* animation: gold-pulse 3s infinite ease-in-out; */
}

/* Бейдж PRO */
.admin-pro-badge {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #000;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 4px;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.4);
    letter-spacing: 0.5px;
}