/* =========================================
   1. ГЛОБАЛЬНЫЕ ПЕРЕМЕННЫЕ И БАЗА
========================================= */
:root {
    --bg-main: #ffffff;
    --bg-surface: #f8fafc;
    --text-main: #000000;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent: #ffde00; /* Желтый акцент */
    
    /* Единые формы */
    --radius-card: 20px;
    --radius-btn: 12px;
    --radius-sm: 8px;
    
    --font-main: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font-main); 
    background-color: var(--bg-main); 
    color: var(--text-main);
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
    -webkit-font-smoothing: antialiased;
}

.container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 20px; 
    width: 100%; 
}

/* Иконки по умолчанию черные */
i.fas, i.far, i.fab, i.fa-solid { color: var(--text-main); transition: 0.2s ease; }

/* =========================================
   2. ТИПОГРАФИКА
========================================= */
.section-title { font-size: clamp(28px, 4vw, 40px); font-weight: 900; margin-bottom: 30px; letter-spacing: -0.5px; text-transform: uppercase; color: var(--text-main); }
mark.highlight, mark.mag-highlight { background: var(--accent); color: var(--text-main); padding: 2px 8px; border-radius: 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone; font-weight: 800; }

/* =========================================
   3. ШАПКА
========================================= */
header { padding: 24px 0; border-bottom: 1px solid var(--border); background: var(--bg-main); position: sticky; top: 0; z-index: 1000;}
.header-content { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 20px; font-weight: 900; text-decoration: none; color: var(--text-main); display: flex; align-items: center; gap: 8px; letter-spacing: 0.5px; text-transform: uppercase; }
.logo i { color: var(--text-main) !important; font-size: 16px; }

#auth-container { display: flex; align-items: center; gap: 12px; }
.user-pill { display: flex; align-items: center; gap: 12px; padding: 4px 16px 4px 4px; border: 1px solid var(--border); border-radius: 40px; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.user-pill img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }

/* =========================================
   4. КНОПКИ И ССЫЛКИ
========================================= */
.btn-primary { background: var(--text-main); color: #fff; padding: 16px 32px; font-size: 14px; font-weight: 800; border: none; border-radius: var(--radius-btn); text-transform: uppercase; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: 0.3s ease; text-decoration: none; }
.btn-primary i { color: #ffffff !important; transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.btn-primary:hover i.fa-plus { transform: rotate(90deg); }
.btn-primary:hover { background: #222; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary { background: transparent; color: var(--text-main); padding: 16px 32px; font-size: 14px; font-weight: 800; border: 1px solid var(--border); border-radius: var(--radius-btn); text-transform: uppercase; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: 0.3s ease; text-decoration: none; }
.btn-secondary:hover { border-color: var(--text-main); }

.back-btn { text-decoration: none; color: var(--text-main); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; display: inline-flex; align-items: center; gap: 12px; transition: color 0.2s; }
.back-btn:hover { color: var(--text-muted); }

.link-with-arrow { font-weight: 800; text-transform: uppercase; color: var(--text-muted); text-decoration: none; font-size: 13px; display: inline-flex; align-items: center; transition: color 0.3s ease; }
.link-with-arrow i { margin-left: 8px; transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.link-with-arrow:hover { color: var(--text-main); }
.link-with-arrow:hover i { transform: translateX(12px); color: var(--text-main); }

.copy-email { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: color 0.2s; color: var(--text-main); }
.copy-email:hover { color: var(--text-muted); }

/* =========================================
   5. УНИВЕРСАЛЬНЫЕ КАРТОЧКИ (Инциденты и Новости)
========================================= */
.universal-card { background: var(--bg-main); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: var(--text-main); transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.4s ease; position: relative; z-index: 1; }
.universal-card:hover { transform: scale(1.04); border-color: #000000; z-index: 10; }

.card-img-wrap { width: 100%; height: 220px; background: var(--bg-surface); border-bottom: 1px solid var(--border); position: relative; }
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.4s ease; }
.card-img-wrap img.loaded { opacity: 1; }
.card-img-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--bg-surface); color: #cbd5e1; }
.card-img-placeholder i { font-size: 32px; color: #cbd5e1 !important; }

.card-badge { position: absolute; top: 16px; left: 16px; padding: 6px 12px; font-size: 10px; font-weight: 900; text-transform: uppercase; border-radius: var(--radius-sm); background: rgba(255,255,255,0.95); color: var(--text-main); backdrop-filter: blur(4px); z-index: 2; border: 1px solid var(--border); }
.card-badge-mine { position: absolute; top: 16px; right: 16px; padding: 6px 12px; font-size: 10px; font-weight: 900; text-transform: uppercase; border-radius: var(--radius-sm); background: var(--text-main); color: var(--accent); z-index: 2; border: 1px solid var(--accent); display: flex; align-items: center; gap: 4px; box-shadow: 0 4px 10px rgba(0,0,0,0.15);}
.card-badge-mine i { color: var(--accent) !important; font-size: 10px; }

.card-content { padding: 24px; display: flex; flex-direction: column; gap: 12px; flex-grow: 1; }
.card-meta { font-size: 12px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; }
.card-meta span { cursor: help; border-bottom: 1px dashed var(--border); }
.card-title { font-size: 18px; font-weight: 800; margin: 0; line-height: 1.4; color: var(--text-main); }
.card-desc { font-size: 14px; color: var(--text-muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-weight: 500; }

.loader, .loader-block { grid-column: 1 / -1; text-align: center; padding: 60px 0; font-weight: 800; color: var(--text-muted); text-transform: uppercase; font-size: 14px; }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 80px 0; color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--radius-card); display: flex; flex-direction: column; align-items: center; justify-content: center;}

/* =========================================
   6. НОВЫЙ ПОДВАЛ И КУКИ (Исправлено)
========================================= */
.site-footer-wrapper { width: 100%; padding: 40px 20px 0; box-sizing: border-box; background: transparent; margin-top: auto; display: flex; justify-content: center; }
.site-footer { background: #000000; width: 100%; max-width: 1200px; padding: 60px 40px; color: #ffffff; border-radius: var(--radius-card); font-family: var(--font-main); box-sizing: border-box; }
.site-footer i { color: #ffffff !important; }

/* Правильная сетка для футера: Лого берет больше места, остальные 3 колонки ровные */
.footer-grid { display: grid; grid-template-columns: 2.5fr 1fr 1fr 1.5fr; gap: 40px; margin-bottom: 60px; }

.footer-brand p { color: #888888; font-size: 13px; line-height: 1.6; margin-top: 16px; max-width: 350px; font-weight: 500; }
.footer-col { display: flex; flex-direction: column; gap: 16px; }
.footer-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; color: #ffffff; }
.footer-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.footer-links a { color: #888888; text-decoration: none; font-size: 13px; transition: color 0.3s; font-weight: 500; }
.footer-links a:hover { color: #ffffff; text-decoration: underline; }

.tg-links-wrapper { display: flex; flex-direction: column; gap: 10px; }
.tg-btn-footer { display: inline-flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.1); padding: 12px 16px; border-radius: 8px; color: #ffffff !important; text-decoration: none; font-size: 13px; font-weight: 700; transition: 0.2s; border: 1px solid rgba(255,255,255,0.05); width: fit-content; }
.tg-btn-footer:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.3); }

.footer-bottom { border-top: 1px solid #333333; padding-top: 24px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; font-size: 12px; color: #666666; font-weight: 500; }

/* Красивый Cookie Banner */
.cookie-banner-wide { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(150%); opacity: 0; z-index: 5000; width: calc(100% - 40px); max-width: 1200px; background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: 0 20px 50px rgba(0,0,0,0.15); transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s; display: flex; }
.cookie-banner-wide.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.cookie-banner-inner { display: flex; align-items: center; justify-content: space-between; padding: 24px 32px; gap: 32px; width: 100%; flex-wrap: wrap; }
.cookie-left { display: flex; align-items: center; gap: 20px; flex: 1; min-width: 250px;}
.cookie-icon { font-size: 32px; color: var(--text-main); }
.cookie-text-block { display: flex; flex-direction: column; gap: 4px; }
.cookie-title { font-weight: 900; font-size: 16px; text-transform: uppercase; letter-spacing: 0.5px; margin: 0; color: var(--text-main); line-height: 1;}
.cookie-desc { font-size: 14px; color: var(--text-muted); font-weight: 500; margin: 0; line-height: 1.5; }
.cookie-actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.cookie-link { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; color: var(--text-muted); text-decoration: none; text-transform: uppercase; transition: 0.2s; }
.cookie-link:hover { color: var(--text-main); text-decoration: underline; }
.cookie-btn { background: var(--text-main); color: #fff; padding: 14px 28px; font-size: 13px; font-weight: 800; border: none; border-radius: 12px; text-transform: uppercase; cursor: pointer; transition: 0.3s ease; }
.cookie-btn:hover { background: var(--accent); color: var(--text-main); }

@media (max-width: 900px) {
    .footer-grid { grid-template-columns: 1fr; gap: 40px; }
    .site-footer { padding: 40px 24px; border-radius: 16px; }
    .cookie-banner-wide { bottom: 10px; width: calc(100% - 20px); }
    .cookie-banner-inner { flex-direction: column; align-items: flex-start; gap: 20px; padding: 20px; }
    .cookie-actions { width: 100%; justify-content: space-between; flex-direction: column-reverse; align-items: stretch;}
    .cookie-btn { width: 100%; text-align: center; }
    .cookie-link { justify-content: center; width: 100%; }
}

/* =========================================
   7. МОДАЛЬНЫЕ ОКНА И ФОРМЫ (КВИЗ, АЛЕРТЫ)
========================================= */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.95); backdrop-filter: blur(5px); z-index: 2000; justify-content: center; align-items: center; }
.modal-content { background: var(--bg-main); width: 100%; max-width: 600px; max-height: 90vh; border-radius: var(--radius-card); border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,0.1); display: flex; flex-direction: column; overflow: hidden; }
.close-modal { cursor: pointer; font-size: 24px; color: var(--text-muted); transition: 0.2s; }
.close-modal:hover { color: #ff3333; }
.modal-body { overflow-y: auto; flex-grow: 1; }

.toast-container { position: fixed; bottom: 30px; right: 30px; z-index: 4000; display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.toast { background-color: var(--text-main); color: var(--accent); font-family: var(--font-main); font-weight: 800; font-size: 14px; padding: 20px 24px; border-radius: var(--radius-sm); box-shadow: 0 15px 40px rgba(0,0,0,0.25); text-transform: uppercase; letter-spacing: 0.5px; line-height: 1.4; max-width: 380px; pointer-events: auto; display: flex; align-items: center; gap: 12px; animation: slideInRight 0.4s forwards, fadeOutToast 0.4s ease 3.5s forwards; }
@keyframes slideInRight { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOutToast { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(10px); } }

/* =========================================
   8. СТРАНИЦА ТИКЕТА И ГАЛЕРЕЯ
========================================= */
.ticket-layout { display: flex; gap: 40px; align-items: flex-start; margin-top: 40px;}
.ticket-media, .ticket-info { flex: 1; width: 50%; }

.gallery-grid { display: grid; gap: 8px; margin-bottom: 24px; border-radius: var(--radius-card); overflow: hidden; height: 400px; }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; transition: 0.3s; border: 1px solid var(--border); box-sizing: border-box; }
.gallery-grid img:hover { border-color: var(--text-main); }
.count-1 { grid-template-columns: 1fr; }
.count-2 { grid-template-columns: 1fr 1fr; }
.count-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.count-3 img:first-child { grid-row: span 2; }
.count-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.count-5 { grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; }
.count-5 img:first-child { grid-row: span 2; }

.meta-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.ticket-id-block { font-weight: 900; font-size: 16px; text-transform: uppercase; }
.ticket-date-block { font-weight: 700; font-size: 14px; color: var(--text-muted); }
.status-group { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 32px; }
.info-item { background: var(--bg-surface); padding: 16px; border-radius: 12px; border: 1px solid var(--border); }
.info-label { display: block; font-size: 10px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; margin-bottom: 6px; }
.info-value { display: block; font-size: 14px; font-weight: 700; color: var(--text-main); word-break: break-all; }
.description { font-size: 16px; line-height: 1.8; margin-bottom: 40px; color: var(--text-main); white-space: pre-wrap; font-weight: 500; }

#photo-overlay { position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.95); display:none; z-index: 9999; justify-content: center; align-items: center; }
#overlay-img { max-width: 90%; max-height: 85%; object-fit: contain; border-radius: 12px; }
.close-overlay { position: absolute; top: 30px; right: 30px; color: #ffffff !important; font-size: 40px; cursor: pointer; background: transparent; border: none; z-index: 10000; padding: 10px; line-height: 1; transition: 0.2s; }
.close-overlay:hover { transform: scale(1.1); }
.slider-nav { position: absolute; top: 50%; transform: translateY(-50%); color: #ffffff; font-size: 40px; cursor: pointer; padding: 20px; opacity: 0.5; transition: 0.2s; }
.slider-nav:hover { opacity: 1; }

/* =========================================
   9. СТРАНИЦЫ ТЕКСТОВЫЕ (ПОЛИТИКА, О ПРОЕКТЕ)
========================================= */
.page-header { margin-bottom: 40px; }
.page-title { font-size: 36px; font-weight: 900; letter-spacing: -1px; margin: 0 0 16px 0; text-transform: uppercase; display: flex; align-items: center; gap: 16px; color: var(--text-main);}
.page-title i { color: var(--accent); font-size: 32px; }
.page-desc { font-size: 16px; color: var(--text-muted); line-height: 1.6; font-weight: 500; max-width: 600px; margin: 0; }

h1 { font-size: 32px; font-weight: 900; letter-spacing: -1px; margin: 0 0 16px 0; line-height: 1.2; text-transform: uppercase; }
h2 { font-size: 20px; font-weight: 800; margin: 40px 0 16px 0; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-main);}
p, li { font-size: 16px; line-height: 1.8; color: #333333; margin-bottom: 16px; font-weight: 500; }
ul { margin-bottom: 24px; padding-left: 20px; }
a.inline-link { color: var(--text-main); font-weight: 700; text-decoration: underline; text-decoration-color: var(--border); transition: 0.2s; }
a.inline-link:hover { color: var(--accent); text-decoration-color: var(--accent); }

.highlight-box { background: var(--bg-surface); border-left: 4px solid var(--accent); padding: 16px 20px; margin-bottom: 24px; font-size: 15px; line-height: 1.6; break-inside: avoid; }

@media (max-width: 1024px) { 
    .ticket-layout { flex-direction: column; }
    .ticket-media, .ticket-info { width: 100%; }
}
@media (max-width: 768px) {
    h1, .page-title { font-size: 28px; } h2 { font-size: 18px; } p, li { font-size: 15px; }
}

/* =========================================
   ОФИЦИАЛЬНЫЕ ВЕДОМСТВА (НОВЫЙ ДИЗАЙН)
========================================= */
.agencies-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); 
    gap: 30px; 
    margin-bottom: 80px; 
}

.agency-card {
    display: flex; 
    flex-direction: column; 
    padding: 32px 24px; 
    background: var(--bg-main);
    border: 1px solid var(--border); 
    border-radius: var(--radius-card); 
    color: var(--text-main);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.4s ease;
    position: relative; 
    z-index: 1; 
    text-decoration: none;
}

.agency-card:hover { 
    transform: scale(1.04); 
    border-color: #000000; 
    z-index: 10; 
}

.agency-header { 
    display: flex; 
    align-items: center; 
    gap: 16px; 
    border-bottom: 1px solid var(--border); 
    padding-bottom: 16px; 
    margin-bottom: 16px; 
}

.agency-logo { 
    width: 50px; 
    height: 50px; 
    flex-shrink: 0; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.agency-logo img { 
    max-width: 100%; 
    max-height: 100%; 
    object-fit: contain; 
    filter: grayscale(100%); 
    transition: filter 0.4s ease; 
}

.agency-card:hover .agency-logo img { 
    filter: grayscale(0%); 
}

.agency-info h3 { 
    font-size: 16px; 
    font-weight: 900; 
    margin: 0 0 4px 0; 
    line-height: 1.3; 
    text-transform: uppercase;
}

.agency-info p { 
    font-size: 11px; 
    color: var(--text-muted); 
    margin: 0; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    line-height: 1.3;
}

.agency-contacts { 
    list-style: none; 
    padding: 0; 
    margin: 0; 
    flex-grow: 1; 
}

.agency-contacts li { 
    display: flex; 
    align-items: flex-start; 
    gap: 12px; 
    font-size: 13px; 
    font-weight: 600; 
    color: var(--text-main); 
    margin-bottom: 12px; 
    line-height: 1.5; 
}

.agency-contacts i { 
    color: var(--text-muted); 
    font-size: 14px; 
    width: 16px; 
    text-align: center; 
    margin-top: 3px; 
    flex-shrink: 0; 
}

.agency-contacts a { 
    color: var(--text-main); 
    text-decoration: none; 
    transition: 0.2s; 
}

.agency-contacts a:hover { 
    color: var(--text-muted); 
}

/* Крупные соцсети для Роспотребнадзора */
.rospotreb-socials { 
    display: flex; 
    gap: 20px; 
    font-size: 24px; 
    margin-top: 8px;
}

.rospotreb-socials a { 
    color: var(--text-muted) !important; 
    transition: 0.2s; 
}

.rospotreb-socials a:hover { 
    color: var(--text-main) !important; 
    transform: translateY(-2px); 
}