* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

#contacts{
    background: linear-gradient(135deg, #4874a0 0%);
    text-align: center;
    color: #fff;
    margin-top: 10px;
    padding: 10px;
}

/* Шапка */
header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    margin-bottom: 1rem;
    font-size: 2rem;
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

nav ul li a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
    font-size: 0.9rem;
}

nav ul li a:hover {
    background-color: rgba(255,255,255,0.2);
}

/* Основной контент */
main {
    flex: 1;
    padding: 2rem 0;
}

/* Формы */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #2c3e50;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    color: #333;
    font-size: 0.9rem;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52,152,219,0.3);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    font-family: 'JetBrains Mono', monospace;
    transition: opacity 0.3s;
}

.btn:hover {
    opacity: 0.9;
}

.btn-small {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    margin-right: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
}

.btn-small:hover {
    background: #2980b9;
}

.btn-danger {
    background: #e74c3c;
}

.btn-danger:hover {
    background: #c0392b;
}

/* Сообщения */
.error, .message {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-family: 'JetBrains Mono', monospace;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Сетка статей */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.article-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.article-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #666;
    margin: 0.5rem 0;
}

.article-content {
    margin-top: 1rem;
    line-height: 1.8;
    color: #333;
    
    /* Перенос текста */
    word-wrap: break-word;        /* Старый вариант */
    overflow-wrap: break-word;    /* Новый стандарт */
    white-space: normal;          /* Обычный перенос строк */
    max-width: 100%;              /* Не выходить за пределы */
}

/* Галерея грамот */
.certificates-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.certificate-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.certificate-card:hover {
    transform: scale(1.05);
}

.certificate-card img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    cursor: pointer;
}

/* Админ-панель */
.admin-tabs {
    margin: 2rem 0;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-family: 'JetBrains Mono', monospace;
    transition: all 0.3s;
}

.tab-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.tab-btn:hover {
    background: #e9ecef;
}

.tab-btn.active:hover {
    background: #2980b9;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.admin-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.items-list {
    display: grid;
    gap: 1rem;
}

.item {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.item h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.item-actions {
    margin-top: 1rem;
}

.certificates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.certificate-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.certificate-item img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

/* Форма входа */
.login-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.login-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #2c3e50;
}

.login-form input {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #333;
    font-family: 'JetBrains Mono', monospace;
}

.login-form input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52,152,219,0.3);
}

.login-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    transition: opacity 0.3s;
}

.login-btn:hover {
    opacity: 0.9;
}

/* Подвал */
footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: auto;
}

/* ========== РЕКЛАМНЫЙ БЛОК (над футером) ========== */
.ads-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 3rem 0;
    margin-top: 3rem;
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
}

.ads-section-title {
    text-align: center;
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 2rem;
    font-weight: normal;
}

.ads-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.ads-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
}

.ad-block {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    width: 200px;
    height: 300px;
    flex-shrink: 0;
}

.ad-block:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.ad-image {
    width: 200px;
    height: 120px;
    overflow: hidden;
    background: #f8f9fa;
    flex-shrink: 0;
}

.ad-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.ad-block:hover .ad-image img {
    transform: scale(1.05);
}

.ad-content {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(300px - 120px); /* 300px минус высота изображения */
    overflow: hidden;
}

.ad-title {
    color: #2c3e50;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ad-description {
    color: #666;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    flex: 1;
    overflow-y: auto;
    word-wrap: break-word;
}

.ad-description::-webkit-scrollbar {
    width: 4px;
}

.ad-description::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ad-description::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 4px;
}

.ad-link {
    display: inline-block;
    color: #3498db;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: bold;
    transition: color 0.3s;
    align-self: flex-start;
    padding: 0.25rem 0;
    border-bottom: 1px solid transparent;
}

.ad-link:hover {
    color: #2980b9;
    border-bottom-color: #2980b9;
}

/* Адаптивность для рекламного блока */
@media (max-width: 768px) {
    .ads-section {
        padding: 2rem 0;
    }
    
    .ads-section-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .ads-grid {
        gap: 1rem;
    }
    
    .ad-block {
        width: 180px;
        height: 280px;
    }
    
    .ad-image {
        width: 180px;
        height: 100px;
    }
    
    .ad-content {
        height: calc(280px - 100px);
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .ads-grid {
        gap: 1rem;
    }
    
    .ad-block {
        width: 160px;
        height: 260px;
    }
    
    .ad-image {
        width: 160px;
        height: 90px;
    }
    
    .ad-content {
        height: calc(260px - 90px);
        padding: 0.5rem;
    }
    
    .ad-title {
        font-size: 0.9rem;
    }
    
    .ad-description {
        font-size: 0.8rem;
    }
}

.video{
    margin: 10px 0;
}

video{
    width: 100%;
}