/* ===== ОСНОВНЫЕ СТИЛИ ===== */
:root {
    --primary-color: #28a745;
    --secondary-color: #2c3e50;
    --text-color: #333;
    --bg-light: rgba(255, 255, 255, 0.95);
}

* {
    box-sizing: border-box;
}

body {
    background: url('https://s3.twcstorage.ru/f6616ff5-mealty-portal-baget/static/img/fone.png') fixed;
    background-size: cover;
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
}

/* ===== ЛAYOUT ===== */
.content.main-layout {
    flex: 1;
    display: flex;
}

.main-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.content-place {
    flex: 1;
}

/* ===== ШАПКИ И НАВИГАЦИЯ ===== */
.top-line {
    background: rgba(44, 62, 80, 0.7);
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-header {
    background: rgba(248, 249, 250, 0.7);
    padding: 10px 15px;
    border-bottom: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: space-between;
}

/* ===== САЙДБАР ===== */
.sidebar {
    background: rgba(248, 249, 250, 0.95);
    padding: 20px;
    min-height: calc(100vh - 120px);
}

.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -100%; 
    width: 300px;
    height: 100vh;
    background: white;
    transition: left 0.3s ease;
    z-index: 1001;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.mobile-sidebar.active {
    left: 0; 
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
}

.overlay.active {
    display: block;
}

#search-input {
    width: 100%;
    margin: 0px 0 0px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
}

#flex {
    display: flex;
    flex-wrap: wrap;
    gap: 8px; /* было 5px */
    margin: 10px 0;
    justify-content: center;
    align-items: center;
}

#news-list li .badge {
    background: #28a745;
    color: black;
    border: 1px solid #28a745;
    float: left;
    margin-right: 10px;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 600;
}

#news-list li .btn-outline-danger {
    background-color: #dc3545;
    color: white;
    border: none;
    float: right;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
}

/* ===== КНОПКИ ===== */
.hamburger-btn {
    background: none;
    border: none;
    font-size: 24px;
    padding: 5px 10px;
    cursor: pointer;
    z-index: 1003;
    display: block;
}

.btn-topic {
    background: rgba(255, 255, 255, 0.3);
    color: black;
    text-decoration: none;
    border: 1px solid var(--primary-color);
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 12px;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-topic.btn-active {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.btn-create-news {
    display: inline-block;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    transition: background 0.3s ease;
    margin: 10px 0 20px 0;
    text-align: center;
}

.btn-create-news:hover {
    background: #218838;
    color: white;
    text-decoration: none;
}

/* ===== ЛЕНТА НОВОСТЕЙ ===== */
#news-list {
    list-style: none;
    padding-left: 0;
}

#news-list li {
    background: rgba(255, 255, 255, 0.7);
    margin: 0 auto 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0px 15px 15px 15px;
    text-align: left;
    max-width: 95%;
}

#news-list li h5 {
    text-align: center;
    width: 100%;
    margin: 10px 0 15px 0;
    clear: both;
    font-size: 18px;
    font-weight: 600;
}

#news-list li img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px 0;
    border-radius: 4px;
}

.news-text {
    text-align: left;
    line-height: 1.5;
    margin: 10px 0;
}

/* ===== КОНТАКТЫ (УНИВИРСАЛЬНЫЕ СТИЛИ) ===== */
.contacts-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.department-title {
    background: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin: 20px 0 15px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

/* Таблицы для десктопа */
.contacts-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.contacts-table th {
    background: var(--secondary-color);
    color: white;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
}

.contacts-table td {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

/* Карточки для мобильных */
.contact-card {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid var(--primary-color);
}

.contact-field {
    display: flex;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.contact-field:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.contact-label {
    font-weight: 600;
    color: var(--secondary-color);
    min-width: 100px;
    margin-right: 10px;
}

.contact-value {
    color: var(--text-color);
    word-break: break-word;
    flex: 1;
}

.contact-value a {
    color: var(--primary-color);
    text-decoration: none;
}

.no-contacts {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
    background: rgba(255,255,255,0.8);
    border-radius: 8px;
    margin: 10px 0;
}

/* ===== ЗАЯВКИ ===== */
.request-card {
    background: var(--bg-light);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-left: 5px solid var(--primary-color);
}

.request-priority { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.priority-high { background: #dc3545; color: white; }
.priority-medium { background: #ffc107; color: #212529; }
.priority-low { background: var(--primary-color); color: white; }

.request-status { padding: 4px 10px; border-radius: 12px; font-weight: 600; }
.status-open { background: #d4edda; color: #155724; }
.status-in-progress { background: #fff3cd; color: #856404; }
.status-closed { background: #f8d7da; color: #721c24; }

/* ===== ФУТЕР ===== */
footer {
    margin-top: auto;
    width: 100%;
}

.bottom-line {
    background: var(--secondary-color);
    color: white;
    text-align: center;
    padding: 10px;
    width: 100%;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    .mobile-header { display: flex !important; }
    .top-line, .sidebar { display: none !important; }
    
    .content.main-layout { display: block; }
    .main-content { padding: 15px; padding-bottom: 80px; }
    
    /* Контакты - показываем карточки, скрываем таблицы */
    .contacts-table { display: none; }
    .contact-card { display: block; }
    
    .contact-field { flex-direction: column; }
    .contact-label { min-width: auto; margin-right: 0; margin-bottom: 4px; }
    
    /* Заявки */
    .request-title { flex-direction: column; align-items: flex-start; gap: 8px; }
    .request-meta { flex-direction: column; align-items: flex-start; gap: 8px; }

    .mobile-sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
        border-bottom: 1px solid #eee;
        background: rgba(248, 249, 250, 0.95);
        font-weight: 600;
    }

    .mobile-close-btn {
        border: none;
        background: none;
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
    }

    /* Список ссылок */
    .mobile-nav {
        padding: 10px 12px 0;
    }

    .mobile-menu {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .mobile-menu li {
        margin-bottom: 8px;
    }

    .mobile-menu a {
        display: block;
        padding: 10px 14px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.9);
        text-decoration: none;
        color: #000;
    }

    /* Блоки инфы и пользователя */
    .mobile-info, .mobile-user {
        padding: 10px 16px 14px;
        border-top: 1px solid #eee;
        background: rgba(255, 255, 255, 0.9);
        margin-top: 10px;
    }

    .mobile-user form {
        margin-top: 6px;
    }
}

@media (min-width: 769px) {

    /* Левое меню */
    .sidebar {
        background: transparent;
        padding: 20px 15px;
    }

    .sidebar-menu {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .sidebar-menu li {
        margin-bottom: 8px;
    }

    .sidebar-menu a {
        display: block;
        padding: 8px 16px;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.7);
        text-decoration: none;
        color: inherit;
    }

    .sidebar-menu a:hover {
        background: rgba(255, 255, 255, 0.9);
    }

    /* Верхняя плашка */
    .top-line {
        background: rgba(255, 255, 255, 0.7);
        color: #333;
        padding: 8px 18px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        box-shadow: 0 2px 6px rgba(0,0,0,0.18);
    }

    .top-line-left img.top-line-image {
        width: 90px;
        height: auto;
        display: block;
    }

    /* Правый блок (дата/время + имя) */
    .top-line-right {
        display: inline-flex;
        align-items: center;
        gap: 12px; /* расстояние между датой/временем и именем */
        background: rgba(255, 255, 255, 0.9);
        border-radius: 12px;
        padding: 6px 10px 6px 12px;
        position: relative;
    }

    .top-line-datetime {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        line-height: 1.2;
        white-space: nowrap;
    }

    .top-line-datetime #current-date,
    .top-line-datetime #weekday {
        font-size: 16px;
    }


    .top-line-time {
        margin-top: 2px;
        font-size: 15px;      /* больше шрифт для времени */
        font-weight: 600;
    }

    .top-line-user {
        position: relative;      /* опорный блок для меню */
        display: flex;
        align-items: center;
    }

    .user-menu-btn {
        border: none;
        background: #ffffff;
        border-radius: 10px;
        padding: 4px 10px;
        font-size: 13px;
        cursor: pointer;
        white-space: nowrap;
    }

    .user-menu {
        position: absolute;
        top: 100%;               /* сразу под кнопкой */
        right: 0;
        margin-top: 4px;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 8px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.2);
        padding: 6px 10px;
        display: none;
        z-index: 1100;
        min-width: 120px;
    }

    .user-menu.open {
        display: block;
    }

    .logout-btn {
        border: none;
        background: #dc3545;
        color: #fff;
        border-radius: 6px;
        padding: 6px 12px;
        font-size: 13px;
        cursor: pointer;
        width: 100%;
        text-align: center;
    }

    .top-line-right {
        display: inline-flex;
        align-items: center;
        gap: 16px; /* расстояние между датой и кнопкой */
        background: rgba(255, 255, 255, 0.9);
        border-radius: 16px;
        padding: 6px 12px;
    }

    .top-line-datetime {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        font-size: 12px;
        line-height: 1.2;
    }

    .top-line-time {
        margin-top: 2px;
        font-size: 15px;
        font-weight: 600;
    }

    .top-line-user {
        position: relative;
    }

    .user-menu-btn {
        border: none;
        background: #ffffff;
        border-radius: 999px;
        padding: 6px 14px;
        font-size: 13px;
        cursor: pointer;
        white-space: nowrap;
        box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    }

    /* обёртка, если есть, либо сам текстовый блок */
    .news-text {
        font-size: 15px;
        line-height: 1.6;
    }

    /* картинка как на старом макете: слева, текст обтекает справа */
    #news-list li img {
        max-width: 45%;              /* картинка занимает левую часть */
        height: auto;
        float: left;
        margin: 10px 20px 12px 0;    /* отступ справа, чтобы текст не прилипал */
        border-radius: 6px;
    }

    /* чтобы после текста блок «сломал» обтекание */
    #news-list li::after {
        content: "";
        display: block;
        clear: both;
    }

    #news-list li h5 {
        font-size: 19px;
        margin: 10px 0 8px;
    }

    .news-text {
        font-size: 15px;
        line-height: 1.6;
        margin: 8px 0 4px;
    }

    #news-list li small {
        display: block;
        margin-top: 6px;
        font-size: 13px;
        color: #555;
    }

    #news-list li {
        background: rgba(255, 255, 255, 0.9);
        margin: 0 auto 20px;
        border: 1px solid #ddd;
        border-radius: 12px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.12);
        padding: 16px 24px 20px;

        max-width: 1200px;           /* шире, ближе к старому виду */
    }
     /* Общий контейнер контента */
    .main-content {
        display: flex;
        flex-direction: column;
        align-items: center;          /* всё по центру по горизонтали */
        padding: 20px 30px;
    }

    /* Заголовок "ЖИВАЯ ЛЕНТА MEALTY" */
    .main-content h1,
    .main-content h2,
    .live-feed-title {
        text-align: center;
        width: 100%;
        margin: 0 0 15px;
    }

    /* Поиск по ширине карточки */
    #search-input {
        width: 100%;
        max-width: 1200px;            /* как у карточки */
        margin: 0 auto 12px;
    }

    /* Кнопка "Создать новую новость" по центру */
    .btn-create-news {
        display: block;
        max-width: 250px;
        margin: 10px auto 20px;       /* центрируем */
    }

    /* Карточки новостей — по центру экрана */
    #news-list {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;          /* центрируем сами li */
    }

    #news-list li {
        width: 100%;
        max-width: 1200px;            /* та же ширина, что у поиска */
        margin: 0 0 20px;
    }
    /* База — общая для всех экранов */

    .documents-title {
        text-align: center;
        margin: 0 0 15px;
        font-size: 24px;
    }

    .documents-list {
        list-style: none;
        margin: 0 0 15px;
        padding: 0;
    }

    .documents-list li:last-child {
        border-bottom: none;
    }

    .documents-list a {
        color: var(--secondary-color);
        text-decoration: none;
        font-weight: 500;
        word-break: break-all;
    }

    .documents-list a:hover {
        text-decoration: underline;
    }

    .no-documents {
        text-align: center;
        color: #777;
        font-style: italic;
    }

    .doc-delete-btn {
        border: none;
        background: #dc3545;
        color: #fff;
        border-radius: 6px;
        padding: 4px 10px;
        font-size: 13px;
        cursor: pointer;
        white-space: nowrap;
    }

    .documents-upload {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 10px;
    }

    .btn-upload-doc {
        border: none;
        background: var(--primary-color);
        color: #fff;
        border-radius: 8px;
        padding: 8px 16px;
        font-weight: 600;
        cursor: pointer;
    }
    .documents-wrapper {
        max-width: 1100px;              /* шире */
        margin: 20px auto 40px;
        padding: 0 20px;
    }

    .documents-card {
        background: rgba(255, 255, 255, 0.9);
        border-radius: 12px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.12);
        padding: 18px 24px 20px;
    }

    /* список тянется почти на всю ширину карточки */
    .documents-list li {
        padding: 10px 0;
    }

    /* кнопка загрузки и инпут — по ширине карточки, а не по центру отдельно */
    .documents-upload {
        justify-content: flex-start;
    }

    .document-item {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 16px;
        padding: 10px 0;
        border-bottom: 1px solid #eee;
    }

    .document-info {
        flex: 1;
    }

    .document-title {
        font-weight: 600;
        margin-bottom: 2px;
    }

    .document-meta {
        font-size: 12px;
        color: #777;
        margin-bottom: 4px;
    }

    .document-desc {
        font-size: 14px;
    }

    .document-actions {
        display: flex;
        flex-direction: column;
        gap: 6px;
        align-items: flex-end;
    }

    .btn-doc-download {
        background: var(--primary-color);
        color: #fff;
        padding: 4px 10px;
        border-radius: 6px;
        text-decoration: none;
        font-size: 13px;
    }
}


/* Ховеры только для десктопа */
@media (hover: hover) {
    .btn-topic:hover {
        background: var(--primary-color);
        color: white;
        transform: scale(1.05);
    }
}

/* Добавить в styles.css: */
#news-list img {
    cursor: zoom-in;
    transition: transform 0.3s ease;
    max-width: 100%;
}

#news-list img.zoomed {
    transform: scale(1.5);
    cursor: zoom-out;
    z-index: 1000;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

img.top-line-image {
    width: 190px;
}