* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-blue: #3b82f6;
    --secondary: #8b5cf6;
    --dark: #0f172a;
    --light: #f8fafc;
    --text: #1e293b;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --success: #10b981;
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8fafc;
    color: var(--text);
    line-height: 1.6;
}

/* ── HEADER (убрали sticky) ── */
header {
    background: rgba(255,255,255,0.97);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.header-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 24px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99,102,241,0.35);
    flex-shrink: 0;
}
.logo-icon span {
    color: white;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: -0.5px;
}
.logo-icon.small { width: 24px; height: 24px; }
.logo-icon.small span { font-size: 9px; }

.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-name {
    font-size: 17px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
}
.logo-tagline { font-size: 11px; color: var(--text-muted); font-weight: 400; letter-spacing: 0.2px; }

/* ── БУРГЕР МЕНЮ ── */
.filter-btn-mobile {
    display: none;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 8px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    position: sticky;
    top: 12px;
    z-index: 100;
}

.filters-close-btn {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    height: 36px;
    flex-shrink: 0;
    margin-bottom: 16px;
    margin-left: auto;
}

.filters-close-btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

/* ── HERO ── */
.hero {
    background: linear-gradient(135deg, #eff6ff 0%, #eef2ff 50%, #f5f3ff 100%);
    border-bottom: 1px solid var(--border);
    padding: 52px 24px 44px;
    text-align: center;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 20px;
    padding: 5px 16px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 20px;
    letter-spacing: 0.3px;
}
.hero h1 {
    font-size: 38px;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.15;
    margin-bottom: 14px;
    letter-spacing: -0.5px;
}
.hero-accent {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p {
    font-size: 16px;
    color: var(--text-light);
    max-width: 540px;
    margin: 0 auto 32px;
    line-height: 1.65;
}
.hero-stats {
    display: inline-flex;
    align-items: center;
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    gap: 28px;
}
.hero-stat { text-align: center; }
.hero-stat-num { font-size: 22px; font-weight: 700; color: var(--dark); line-height: 1; }
.hero-stat-lbl { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.hero-stat-div { width: 1px; height: 36px; background: var(--border); }

/* ── FILTERS (убрали sticky) ── */
.filters {
    background: #f8fafc;
    max-width: 100%;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.filters-container {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

.search-wrap {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-bottom: 16px;
}
.search-wrap input {
    flex: 1;
    padding: 13px 18px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    background: white;
    color: var(--text);
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.search-wrap input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.search-btn {
    padding: 13px 28px;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
    transition: all 0.2s ease;
    white-space: nowrap;
}
.search-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(99,102,241,0.4); }

.filters-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 120px;
    flex: 1;
}
.date-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-width: 120px; 
    flex: 1;
}
.filter-group > label:first-child {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.date-group label{
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.date-group input[type="date"] {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    background: white;
    color: var(--text);
    transition: all 0.2s ease;
    cursor: pointer;
}
.date-group input[type="date"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

.city-wrap { position: relative; }
.city-wrap input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    background: white;
    color: var(--text);
    transition: all 0.2s ease;
}
.city-wrap input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.city-wrap input.invalid { border-color: #ef4444; }

.ac-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    max-height: 220px;
    overflow-y: auto;
    z-index: 300;
    display: none;
}
.ac-dropdown.open { display: block; }
.ac-item { padding: 9px 12px; cursor: pointer; font-size: 13px; color: var(--text); transition: background 0.12s; }
.ac-item:hover, .ac-item.hi { background: #f1f5f9; }
.ac-empty { padding: 9px 12px; font-size: 13px; color: var(--text-muted); font-style: italic; }

.spec-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 5px;
}
.spec-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.spec-tag button {
    background: rgba(255,255,255,0.25);
    border: none;
    color: white;
    border-radius: 50%;
    width: 16px; height: 16px;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
}

.tooltip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    cursor: help;
}
.tooltip-icon {
    width: 15px; height: 15px;
    background: #94a3b8;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
}
.tooltip-box {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    width: 220px;
    line-height: 1.5;
    z-index: 400;
    pointer-events: none;
}
.tooltip-wrap:hover .tooltip-box { display: block; }

.filter-reset {
    padding: 9px 14px;
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.filter-reset:hover { border-color: #ef4444; color: #ef4444; }

.format-selected {
    width: 100%;
    padding: 7px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    background: white;
    color: var(--text);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.format-selected::after {
    content: '▼';
    position: absolute;
    right: 12px;
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.format-selected.open::after {
    transform: rotate(180deg);
}

.format-selected:hover {
    border-color: var(--primary-dark);
}

/* ── EVENTS (увеличил отступ сверху) ── */
.events-container { 
    max-width: 1100px; 
    margin: 0 auto 4rem; 
    padding: 0 24px;
    margin-top: 48px; /* УВЕЛИЧЕННЫЙ ОТСТУП */
}

.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    align-items: stretch;
}

.to-vebinar {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(59, 130, 246, 0.1); 
    color: var(--primary-blue);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid rgba(59, 130, 246, 0.2);
    line-height: 1; /* Чтобы текст был ровно по центру */
}

.to-vebinar:hover {
    background: var(--primary-blue);
    color: white !important; /* !important на случай, если общие стили ссылок перебивают цвет */
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.to-vebinar::after {
    content: '→';
    font-size: 14px;
    transition: transform 0.2s ease;
}

.to-vebinar:hover::after {
    transform: translateX(3px);
}

/* ── CARD ── */
.event-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
}
.event-card:hover { transform: translateY(-6px); box-shadow: 0 12px 28px rgba(0,0,0,0.1); }

.event-image {
    width: 100%;
    height: 220px;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}
.event-image img { width: 100%; height: 100%; object-fit: cover; }
.event-image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary));
}
.event-image-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,1) 0%, transparent 55%);
    pointer-events: none;
    z-index: 1;
}

.event-date-overlay {
    position: absolute;
    bottom: 12px;
    left: 14px;
    z-index: 2;
    line-height: 1;
}
.event-date-overlay .day {
    font-size: 32px;
    font-weight: 800;
    color: white;
    display: block;
}
.event-date-overlay .month {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    display: block;
    margin-top: 2px;
}
.event-date-overlay.approx .month {
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.event-body {
    padding: 16px 16px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.event-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.4;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.event-location { font-size: 12px; color: var(--text-muted); }

.event-footer {
    display: flex;
    gap: 8px;
    padding: 12px 16px 16px;
    margin-top: auto;
}
.btn-register {
    flex: 1;
    padding: 9px;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary));
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}
.btn-register:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.35); }
.btn-details {
    flex: 1;
    padding: 9px;
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}
.btn-details:hover { background: var(--primary); color: white; }

.sentinel { height: 40px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 13px; margin-top: 1rem; }

/* ── КНОПКА НАВЕРХ ── */
.scroll-top-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary));
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99,102,241,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 999;
}

.scroll-top-btn.visible {
    display: flex;
}

.scroll-top-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(99,102,241,0.5);
}

/* ── MODAL ── */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background: white; border-radius: 14px; padding: 2rem; max-width: 560px; width: 90%; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-header h2 { font-size: 1.3rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.form-group input { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; transition: all 0.2s; }
.form-group input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.btn-submit { width: 100%; padding: 13px; background: linear-gradient(135deg, var(--primary-blue), var(--primary)); color: white; border: none; border-radius: 8px; font-weight: 600; font-size: 15px; cursor: pointer; box-shadow: 0 4px 12px rgba(99,102,241,0.3); transition: all 0.2s; }
.btn-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(99,102,241,0.4); }

.details-row { display: flex; gap: 8px; margin-bottom: 10px; font-size: 14px; }
.details-lbl { color: var(--text-muted); font-weight: 600; min-width: 110px; flex-shrink: 0; }
.details-desc { margin: 12px 0; font-size: 14px; color: var(--text); line-height: 1.7; }

.loading { text-align: center; padding: 3rem; color: var(--text-muted); }
.message { padding: 12px 18px; border-radius: 8px; margin-bottom: 1rem; font-weight: 500; font-size: 14px; }
.message.success { background: rgba(16,185,129,0.1); color: var(--success); }
.message.error { background: rgba(239,68,68,0.1); color: #ef4444; }

/* ── FOOTER ── */
footer {
    background: var(--dark);
    color: #64748b;
    padding: 28px 24px;
    margin-top: 4rem;
}
.footer-inner { max-width: 1100px; margin: 0 auto; text-align: center; }
.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 600;
    color: white;
}
.footer-inner p { font-size: 13px; margin-bottom: 4px; }
.footer-desc { font-size: 12px; color: #475569; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* ── МОБИЛЬНАЯ ВЕРСИЯ ── */
@media (max-width: 800px) {
    .hero h1 { font-size: 26px; }
    .hero-stats { flex-direction: column; gap: 12px; padding: 16px 24px; }
    .hero-stat-div { width: 40px; height: 1px; }
    .events-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .search-wrap { flex-direction: column; }
    .search-btn { width: 100%; }
    .filter-btn-mobile { display: flex; }
    .filters-close-btn { display: flex; }
    .date-group { max-width: none;
    width: 100%;}

    .filters {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: white;
        box-shadow: 2px 0 12px rgba(0,0,0,0.1);
        transition: left 0.3s ease;
        padding: 20px;
        overflow-y: auto;
        z-index: 1001;
    }
    
    .filters.open {
        left: 0;
    }
    
    .filters-row {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    /* Overlay при открытом бургере */
    body::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1000;
        display: none;
    }

    body.filters-open::after {
        display: block;
    }
    
    .scroll-top-btn {
        bottom: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
    }
}
