/* ===================================================
   ЦифроСити Корпоративный Портал — Стили
   Файл: css/style.css
   =================================================== */

:root {
    --red: #C0392B;
    --red-dark: #922B21;
    --red-light: #E74C3C;
    --red-pale: #FDECEA;
    --white: #FFFFFF;
    --gray-50: #F8F9FA;
    --gray-100: #F1F3F4;
    --gray-200: #E8EAED;
    --gray-400: #9AA0A6;
    --gray-600: #5F6368;
    --gray-800: #202124;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.18s ease;
    --sidebar-w: 240px;
    --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    font-size: 14px;
}

/* ── КНОПКИ ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.btn-primary { background: var(--red); color: white; }
.btn-primary:hover { background: var(--red-dark); box-shadow: var(--shadow); }
.btn-outline { background: transparent; border: 1.5px solid var(--red); color: var(--red); }
.btn-outline:hover { background: var(--red-pale); }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-danger { background: #922B21; color: white; }
.btn-success { background: #1e7e34; color: white; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── ФОРМЫ ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 500; margin-bottom: 6px; color: var(--gray-600); font-size: 13px; }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    background: white;
    color: var(--gray-800);
    transition: border-color var(--transition);
    outline: none;
}
.form-control:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(192,57,43,0.12); }
.form-control::placeholder { color: var(--gray-400); }
select.form-control { cursor: pointer; }

/* ── КАРТОЧКИ ── */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    border: 1px solid var(--gray-200);
}
.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── БЕЙДЖИ ── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-super_admin { background: #2C3E50; color: white; }
.badge-integrator { background: #8E44AD; color: white; }
.badge-ops_manager { background: #2980B9; color: white; }
.badge-store_admin { background: #16A085; color: white; }
.badge-sales_manager { background: #27AE60; color: white; }
.badge-active { background: #d4edda; color: #155724; }
.badge-blocked { background: #f8d7da; color: #721c24; }

/* ── ТАБЛИЦА ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead th {
    background: var(--red);
    color: white;
    padding: 12px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }

/* ── НАВИГАЦИЯ ── */
#sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--gray-800);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    transition: transform var(--transition);
}
#sidebar .logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
#sidebar .logo-text {
    font-size: 22px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}
#sidebar .logo-sub {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}
#sidebar .logo-accent { color: var(--red-light); }

#sidebar nav { padding: 12px 0; flex: 1; }
.nav-section {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 14px;
    user-select: none;
    text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-item.active { background: var(--red); color: white; }
.nav-item .icon { width: 18px; flex-shrink: 0; font-size: 16px; }

#sidebar .sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-chip .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 14px;
    overflow: hidden;
    flex-shrink: 0;
}
.user-chip .avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-chip .name { font-size: 13px; font-weight: 500; color: white; }
.user-chip .role-label { font-size: 11px; color: rgba(255,255,255,0.4); }

/* ── MAIN CONTENT ── */
#main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
#topbar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}
#topbar h1 { font-size: 18px; font-weight: 600; color: var(--gray-800); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

#content { padding: 24px; flex: 1; }

/* ── СТРАНИЦЫ ── */
.page { display: none; }
.page.active { display: block; }

/* ── СЕТКА СТАТИСТИКИ ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--red);
    border-radius: 4px 0 0 4px;
}
.stat-label { font-size: 12px; color: var(--gray-400); font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--gray-800); }
.stat-sub { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.stat-trend { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; }
.stat-trend.up { color: #1e7e34; }
.stat-trend.down { color: var(--red); }

/* ── НОМИНАЦИИ ── */
.nominations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.nomination-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    text-align: center;
    padding: 28px 20px;
    transition: box-shadow var(--transition);
}
.nomination-card:hover { box-shadow: var(--shadow); }
.nomination-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--red-pale);
    margin: 0 auto 12px;
    border: 3px solid var(--red);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--red);
}
.nomination-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nomination-title { font-size: 13px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.nomination-name { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.nomination-desc { font-size: 13px; color: var(--gray-600); }
.trophy-icon { font-size: 28px; margin-bottom: 8px; }

/* ── МОДАЛЬНОЕ ОКНО ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-400); line-height: 1; padding: 4px; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 10px; }

/* ── ТОСТЫ ── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: white;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    border-left: 4px solid var(--red);
    animation: slideIn 0.2s ease;
}
.toast.success { border-color: #27AE60; }
.toast.error { border-color: var(--red); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── ПРОГРЕСС-БАР ── */
.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 4px;
}
.progress-fill {
    height: 100%;
    background: var(--red);
    border-radius: 4px;
    transition: width 0.6s ease;
}
.progress-fill.good { background: #27AE60; }
.progress-fill.warn { background: #F39C12; }

/* ── ТАБЫ ── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid var(--gray-200); }
.tab-btn {
    padding: 10px 18px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-400);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
}
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── CANVAS CHART ── */
.chart-wrap { position: relative; height: 280px; }

/* ── ЛОГИН СТРАНИЦА ── */
#login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #2C3E50 60%, #C0392B 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo-text { font-size: 32px; font-weight: 800; color: var(--gray-800); letter-spacing: -1px; }
.login-logo-accent { color: var(--red); }
.login-logo-sub { font-size: 12px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 2px; margin-top: 4px; }

/* ── СКРЫТИЕ ── */
.hidden { display: none !important; }
[data-role-hide] { display: none; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); }
    #sidebar.open { transform: translateX(0); }
    #main { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .nominations-grid { grid-template-columns: 1fr; }
}

/* ── АВАТАР В ПРОФИЛЕ ── */
.profile-avatar-wrap {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
}
.profile-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--red-pale);
    border: 3px solid var(--red);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    color: var(--red);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-edit-btn {
    position: absolute;
    bottom: 0; right: 0;
    background: var(--red);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px; height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
}

/* ── ПУСТЫЕ СОСТОЯНИЯ ── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-400);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; color: var(--gray-600); margin-bottom: 6px; }

/* ── BREADCRUMBS ── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-400); margin-bottom: 16px; }
.breadcrumb span { color: var(--gray-600); font-weight: 500; }

/* ── INVITE LINK BOX ── */
.invite-box {
    background: var(--red-pale);
    border: 1px solid rgba(192,57,43,0.2);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}
.invite-link { flex: 1; font-size: 12px; word-break: break-all; color: var(--red-dark); font-family: monospace; }

/* ── AUDIT LOG ── */
.audit-row { padding: 10px 0; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
.audit-action { font-weight: 500; }
.audit-time { color: var(--gray-400); font-size: 11px; }
