/* Сброс и базовые стили */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Times New Roman', serif; color: #000; background: #f5f5f5; }

/* ХЕДЕР */
header {
    position: relative;
    width: 100%;
    height: 320px;
    overflow: hidden;
}
.header-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0; left: 0;
}
.logo-container {
    position: absolute;
    top: 70px;
    left: 40px;
    z-index: 10;
}
.site-logo {
    width: 150px;
    height: 150px;
    display: block;
}
.header-text {
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    text-align: left;
    z-index: 10;
}
.tsn {
    font-family: 'Times New Roman', serif;
    font-size: 100px;
    font-weight: bold;
    color: black;
    display: block;
    margin-left: 200px;
}
.tszh {
    font-family: Arial, sans-serif;
    font-size: 60px;
    font-weight: bold;
    color: black;
    display: block;
    margin-left: 530px;
}

/* ОСНОВНОЙ ФОН И ЗАГОЛОВОК */
.background-image {
    position: relative;
    width: 100%;
    min-height: auto; /* Убираем 100vh */
    background: url('../images/background_title.png') no-repeat center top;
    background-size: cover;
    padding-bottom: 20px; /* Значительно уменьшаем отступ */
}
.page-title {
    text-align: center;
    padding-top: 80px;
    font-size: 60px;
    color: black;
    font-family: Arial, sans-serif;
    margin-bottom: 40px;
}

/* БОКОВАЯ ПАНЕЛЬ */
.side-panel {
    position: static;
    left: 20px;
    top: 400px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 1000;
    max-height: calc(100vh - 450px); /* Ограничиваем высоту */
    overflow-y: auto; /* Добавляем скролл если нужно */
}
.nav-button {
    width: 250px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: black;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid #000;
    border-radius: 8px;
    transition: all 0.3s ease;
}
.nav-button:hover {
    background-color: rgba(255, 255, 255, 1);
}

/* СТИЛИ ДЛЯ INDEX.PHP */
.news-feed {
    margin: 10px 10px 100px 400px; /* Увеличиваем bottom margin */
    max-height: 600px;
    overflow-y: auto;
    border: 20px solid #000;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
}
.news-item {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 3px solid #000;
    transition: all 0.3s ease;
}
.news-item:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    border-color: #333;
}
.news-item h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 22px;
    border-bottom: 4px solid #000;
    padding-bottom: 10px;
}
.news-text {
    line-height: 1.7;
    color: #555;
    margin-bottom: 15px;
    white-space: pre-wrap;
}
.news-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
    border: 4px solid #000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.news-date {
    color: #666;
    font-size: 14px;
    margin-top: 10px;
    border-top: 3px solid #000;
    padding-top: 10px;
}

/* АДМИН ПАНЕЛЬ */
.admin-panel {
    margin: 20px 400px;
    background: rgba(255,255,255,0.95);
    padding: 20px;
    border: 2px solid #000;
    border-radius: 8px;
}

/* Формы */
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.form-group label {
    font-weight: bold;
    color: #333;
    font-size: 14px;
}
.form-group input,
.form-group textarea {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}
.form-group textarea {
    height: 120px;
    resize: vertical;
    line-height: 1.5;
}
.form-group small {
    color: #666;
    font-size: 13px;
    margin-top: 8px;
    display: block;
    line-height: 1.4;
}

/* СТИЛИ ДЛЯ LOGIN */
.login-container {
    margin: 100px auto;
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    text-align: center;
    width: 400px;
    max-width: 90%;
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.login-form input {
    padding: 15px;
    border: 2px solid #000;
    border-radius: 5px;
    font-size: 16px;
}
.login-form button {
    padding: 15px;
    background: #000;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
}
.error {
    color: red;
    margin-bottom: 15px;
    font-weight: bold;
}
.back-link {
    display: inline-block;
    margin-top: 20px;
    color: #000;
    text-decoration: none;
}

/* ФУТЕР */
footer {
    width: 100%;
    height: 400px; /* Увеличиваем высоту */
    background: #42356d url('../images/Syzran_footer.png') no-repeat center center;
    background-size: contain; /* Меняем cover на contain */
    position: relative;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 50px;
}
.footer-icon img {
    width: 60px;
    height: 60px;
    transition: transform 0.3s ease;
}
.footer-icon:hover img {
    transform: scale(1.1);
}
.footer-address {
    color: white;
    font-size: 22px;
    font-weight: bold;
    text-align: center;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8);
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}
.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 50px;
}

/* Для мобильных устройств */
@media (max-width: 768px) {
    .footer-address {
        font-size: 16px;
        padding: 0 10px;
    }
    
    .footer-content {
        padding: 0 20px;
        flex-direction: column;
        gap: 15px;
    }
    
    .footer-address {
        order: 3; /* Адрес внизу на мобильных */
        width: 100%;
        margin-top: 10px;
    }
}

/* МОДАЛЬНОЕ ОКНО */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
}
.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%; max-width: 400px;
    text-align: center;
    border-radius: 10px;
}
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

/* АДАПТИВНОСТЬ */
@media (max-width: 768px) {
    .header-text {
        left: 20px;
        top: 50px;
    }
    .tsn { font-size: 50px; }
    .tszh { font-size: 30px; }
    .logo-container {
        top: 20px;
        left: 20px;
    }
    .site-logo {
        width: 80px;
        height: 80px;
    }
    
    .side-panel {
        position: static;
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        margin: 20px;
        gap: 10px;
        max-height: none;
        overflow-y: visible;
        position: static;
    }
    rules-content {
        margin-left: 20px !important;
        padding: 10px;
    }
    .nav-button {
        width: 45%;
        height: 50px;
        font-size: 16px;
    }
    
    .page-title { font-size: 40px; padding-top: 40px; }
    
    .news-feed,
    .admin-panel {
        margin: 20px;
        width: calc(100% - 40px);
    }
    
    .news-feed {
        margin-bottom: 300px; /* Меньший отступ на мобильных */
        max-height: none;
    }
    .no-content-message {
        margin: 20px !important; /* На мобильных убираем большой отступ */
    }
    
    .content-image {
        margin-left: 20px !important;
        max-width: calc(100% - 40px) !important;
    }
    
    .footer-content {
        padding: 0 20px;
    }
    .footer-icon img {
        width: 40px;
        height: 40px;
    }
}

/* Кнопка открытия админ-панели */
.admin-button-container {
    position: fixed;
    top: 350px;
    right: 20px;
    z-index: 1001;
}

.admin-toggle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.admin-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* Модальное окно админ-панели */
.admin-modal h2 {
    text-align: center;
    margin-bottom: 25px;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 15px;
}

/* Формы в модальном окне */
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    height: 120px;
    resize: vertical;
    line-height: 1.5;
}

.form-group small {
    color: #666;
    font-size: 13px;
    margin-top: 8px;
    display: block;
    line-height: 1.4;
}

/* Кнопки форм */
.form-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}
.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-secondary:hover {
    background: #545b62;
    transform: translateY(-2px);
}

/* Ссылки админа */
.admin-links {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.logout-link {
    color: #dc3545;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}
.logout-link:hover {
    color: #c82333;
    text-decoration: underline;
}

/* Действия админа */
.admin-actions {
    margin-top: 15px;
    text-align: right;
}
.delete-link {
    color: #dc3545;
    text-decoration: none;
    padding: 8px 16px;
    border: 2px solid #dc3545;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    display: inline-block;
}
.delete-link:hover {
    background: #dc3545;
    color: white;
    transform: translateY(-2px);
}

/* Улучшенные стили для карточек документов */
.no-content-message {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255,255,255,0.9);
    border-radius: 12px;
    margin: 20px 400px; /* Уже есть отступ слева */
}

.no-content-message h3 {
    color: #666;
    margin-bottom: 15px;
    font-size: 24px;
}

.no-content-message p {
    color: #888;
    font-size: 16px;
}

.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin: 10px 10px 100px 400px; /* Увеличиваем bottom margin */
    padding: 20px 0;
}

.doc-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    padding: 30px 25px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transition: all 0.4s ease;
    border: 1px solid #e9ecef;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.doc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.doc-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.doc-icon {
    font-size: 56px;
    margin-bottom: 20px;
    filter: grayscale(0.3);
    transition: all 0.3s ease;
}

.doc-card:hover .doc-icon {
    transform: scale(1.1);
    filter: grayscale(0);
}

.doc-card h4 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 600;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.doc-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
}

.view-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    flex: 1;
    justify-content: center;
}

.view-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    color: white;
}

.delete-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dc3545;
    color: white;
    text-decoration: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 44px;
}

.delete-link:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
    color: white;
}

/* Адаптивность для модальных окон */
@media (max-width: 768px) {
    .no-content-message,
    .alert {
        margin: 20px !important;
    }
    
    .documents-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin: 20px !important;
        margin-bottom: 300px; /* Меньший отступ на мобильных */
    }
    
    .doc-card {
        padding: 25px 20px;
    }
    
    .doc-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .view-link,
    .delete-link {
        width: 100%;
        justify-content: center;
    }
}

/* Анимация появления карточек */
.doc-card {
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Стили для сообщений */
.alert {
    padding: 15px 20px;
    margin: 20px 400px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
    border: none;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* Для пустого контента */
.no-content {
    text-align: center;
    padding: 100px 20px;
    color: #666;
    font-size: 18px;
}

/* Улучшения для основного контента */
.news-feed,
.documents-grid {
    position: relative;
    z-index: 1;
}

/* Анимация для иконок футера */
.footer-icon {
    transition: all 0.3s ease;
}

.footer-icon:hover {
    transform: translateY(-3px);
}

