/* ============================================================
   GLOBAL STYLES — Современный стиль 2025
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #f6f6f4;
    --bg2:       #efefed;
    --surface:   #ffffff;
    --border:    #e4e4e0;
    --red:       #c0392b;
    --red2:      #e74c3c;
    --red-soft:  #fce8e6;
    --red-border:#f0a49e;
    --dark:      #18181b;
    --text:      #27272a;
    --muted:     #71717a;
    --font:      'Manrope', 'Segoe UI', sans-serif;
    --mono:      'JetBrains Mono', monospace;
    --radius:    14px;
    --radius-sm: 8px;
    --shadow:    0 2px 8px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background-color: var(--bg);
    background-image: linear-gradient(rgba(250,250,248,0.88), rgba(250,250,248,0.92)), url('/assets/bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    font-size: 15px;
    line-height: 1.6;
}

.main-header, .wrapper, .main-footer, #help-bubble {
    position: relative;
    z-index: 1;
}

/* ── ХЕДЕР ── */
.main-header {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    min-width: 0;
    box-sizing: border-box;
}

.main-header .logo {
    font-size: 18px;
    font-weight: 800;
    color: var(--dark);
    text-decoration: none;
    letter-spacing: -0.5px;
    margin-right: 8px;
}

.main-header .logo span {
    color: var(--red);
}

/* ── НАВИГАЦИЯ ── */
.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.main-nav a {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    transition: all 0.15s;
}

.main-nav a:hover {
    color: var(--dark);
    background: var(--bg2);
}

.main-nav a.active {
    color: #fff;
    background: var(--red);
}

/* ── БЕЙДЖ ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-red   { background: #fee2e2; color: #991b1b; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-blue  { background: #dbeafe; color: #1e40af; }
.badge-gray  { background: var(--bg2); color: var(--muted); }
.badge-amber { background: #fef3c7; color: #92400e; }

/* ── КАРТОЧКИ ── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 24px;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-plain {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
}

/* ── КНОПКИ ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--red);
    color: #fff;
}
.btn-primary:hover { background: var(--red2); transform: translateY(-1px); }

.btn-secondary {
    background: var(--bg2);
    color: var(--dark);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--dark); background: var(--bg2); }

/* ── ИНПУТЫ ── */
input, select, textarea {
    font-family: var(--font);
    font-size: 14px;
    color: var(--dark);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(192,57,43,0.1);
    background: #fff;
}

/* ── ТАБЛИЦЫ ── */
table { border-collapse: collapse; width: 100%; }
th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── СТАТУСЫ ── */
.status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
}
.status-green  { background: #dcfce7; color: #166534; }
.status-red    { background: #fee2e2; color: #991b1b; }
.status-amber  { background: #fef3c7; color: #92400e; }
.status-blue   { background: #dbeafe; color: #1e40af; }
.status-gray   { background: var(--bg2); color: var(--muted); }

/* ── FOOTER ── */
.main-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 16px 32px;
    font-size: 13px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    min-width: 0;
    box-sizing: border-box;
}

/* ── АНИМАЦИИ ── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.fade-up { animation: fadeUp 0.3s ease; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── УТИЛИТЫ ── */
.wrapper { max-width: 1200px; margin: 0 auto; padding: 28px 20px; min-width: 0; width: 100%; box-sizing: border-box; }
.text-muted { color: var(--muted); }
.text-red   { color: var(--red); }
.text-dark  { color: var(--dark); }
.font-mono  { font-family: var(--mono); }

/* ── НАВИГАЦИОННЫЕ ПИЛЮЛИ (для внутренних страниц) ── */
.page-nav {
    display: flex;
    gap: 6px;
    padding: 6px;
    background: var(--bg2);
    border-radius: 12px;
    margin-bottom: 24px;
    width: fit-content;
}
.page-nav a {
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    transition: all 0.15s;
}
.page-nav a.active, .page-nav a:hover {
    background: #fff;
    color: var(--dark);
    box-shadow: var(--shadow);
}
.page-nav a.active { color: var(--red); }
/* ============================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ — 768px и ниже
   ============================================================ */
@media (max-width: 768px) {

    /* Хедер */
    .main-header {
        padding: 0 16px;
        gap: 4px;
        flex-wrap: wrap;
        height: auto;
        min-height: 60px;
    }
    .main-nav {
        gap: 2px;
        flex-wrap: wrap;
    }
    .main-nav a {
        padding: 5px 10px;
        font-size: 13px;
    }

    /* Футер */
    .main-footer {
        padding: 14px 16px;
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }

    /* Wrapper */
    .wrapper { padding: 16px 12px; }

    /* Кнопки */
    .btn { padding: 8px 14px; font-size: 13px; }
}

/* ============================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ — 480px и ниже
   ============================================================ */
@media (max-width: 480px) {
    .main-header { padding: 0 12px; }
    .main-nav a { padding: 4px 8px; font-size: 12px; }
    .wrapper { padding: 12px 10px; }
}

/* ── БАЗОВАЯ ЗАЩИТА ОТ ГОРИЗОНТАЛЬНОГО СКРОЛЛА ── */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}
* {
    box-sizing: border-box;
}
img, video, iframe, table {
    max-width: 100%;
}

@media (max-width: 768px) {
    .wrapper {
        padding: 12px 12px;
        overflow-x: hidden;
    }
    /* Все инлайн гриды с фиксированными колонками */
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    /* Но карьеру делаем 2 колонки */
    [style*="grid-template-columns:repeat(5,1fr)"] {
        grid-template-columns: 1fr 1fr !important;
    }
    /* Форму вывода оставляем 1 колонку */
    [style*="display:flex"] {
        flex-wrap: wrap;
    }
}