/* Панель администратора */
.admin-panel {
    background: #fff8e1;
    border-bottom: 3px solid #ffc107;
    padding: 1.5rem 0;
}

.admin-panel h2 {
    margin-bottom: 1rem;
    color: #856404;
    font-weight: 600;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    overflow-y: auto;
}

.modal-content {
    background: var(--bg-white);
    margin: 5% auto;
    padding: 2.5rem;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.15);
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 700;
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    transition: all 0.2s ease;
    background: none;
    border: none;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover {
    color: var(--text-primary);
    transform: rotate(90deg) scale(1.1);
}

/* Сетка новостей */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Карточка новости */
.news-card {
    background: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    cursor: pointer;
    height: 100%;
    min-height: 450px;
}

.news-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.news-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--primary-color) 0%, #2d4a7c 100%);
    flex-shrink: 0;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-body {
    padding: 1.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.news-date {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
    flex-shrink: 0;
}

.news-title {
    color: var(--primary-color);
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.news-preview {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: auto;
    font-size: 0.95rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    flex: 1;
    min-height: 0;
}

.news-content {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 1rem;
    flex: 1;
}

.news-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.news-actions button {
    pointer-events: auto;
}

.btn-edit {
    /* Используется как .btn.btn-warning.btn-sm — оставлен для обратной совместимости */
    background: #D97706;
    color: white;
    padding: 8px 16px;
    border: 2px solid #D97706;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    font-weight: 600;
    font-family: inherit;
}

.btn-edit:hover {
    background: #B45309;
    border-color: #B45309;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.btn-delete {
    /* Используется как .btn.btn-danger.btn-sm — оставлен для обратной совместимости */
    background: #DC2626;
    color: white;
    padding: 8px 16px;
    border: 2px solid #DC2626;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    font-weight: 600;
    font-family: inherit;
}

.btn-delete:hover {
    background: #B91C1C;
    border-color: #B91C1C;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* Модальное окно новости */
.modal-large {
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    margin: 5% auto;
}

.modal-large::-webkit-scrollbar {
    width: 8px;
}

.modal-large::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

.modal-large::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.modal-large::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

#newsForm {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-control {
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

#newsForm input,
#newsForm textarea {
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

#newsForm input:focus,
#newsForm textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

#newsForm textarea {
    resize: vertical;
    min-height: 150px;
}

/* Загрузка изображений */
.image-upload-options {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.upload-tabs {
    display: flex;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.upload-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    font-family: inherit;
}

.upload-tab:hover {
    background: rgba(37, 99, 235, 0.05);
    color: var(--text-primary);
}

.upload-tab.active {
    background: white;
    color: var(--accent-color);
    font-weight: 600;
    border-bottom: 2px solid var(--accent-color);
}

.upload-content {
    padding: 1rem;
}

.upload-panel {
    display: none;
}

.upload-panel.active {
    display: block;
}

.image-preview {
    margin-top: 1rem;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.form-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.form-buttons button {
    flex: 1;
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Адаптивность */
@media (max-width: 768px) {
    .news-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .news-card {
        margin: 0;
    }
    
    .news-image {
        height: 180px;
    }
    
    .news-title {
        font-size: 1.3rem;
    }
    
    .modal-large {
        width: 95%;
        max-height: 90vh;
        margin: 3% auto;
    }
    
    #newsViewContent {
        max-height: calc(90vh - 5rem);
    }
    
    .news-view-title {
        font-size: 1.5rem;
    }
    
    .news-view-image {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .news-body {
        padding: 1rem;
    }
    
    .news-title {
        font-size: 1.2rem;
    }
    
    .news-actions {
        flex-direction: column;
    }
    
    .btn-edit,
    .btn-delete {
        width: 100%;
    }
    
    .form-buttons {
        flex-direction: column;
    }
    
    .modal-large {
        width: 100%;
        max-height: 95vh;
        margin: 0;
        border-radius: 0;
    }
    
    #newsViewContent {
        max-height: calc(95vh - 5rem);
    }
    
    .news-view-title {
        font-size: 1.3rem;
    }
    
    .news-view-content {
        font-size: 1rem;
    }
}

/* Модальное окно просмотра новости */
#newsViewContent {
    max-height: calc(85vh - 5rem);
    overflow-y: auto;
    padding-right: 0.5rem;
}

#newsViewContent::-webkit-scrollbar {
    width: 8px;
}

#newsViewContent::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

#newsViewContent::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

#newsViewContent::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

.news-view-image {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.news-view-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-view-header {
    margin-bottom: 2rem;
}

.news-view-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.news-view-title {
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

.news-view-content {
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 1.05rem;
}

.news-view-content br {
    margin-bottom: 1rem;
}
