/*
Theme Name: Методическая копилка
Theme URI: https://metodkopilka.ru
Author: Ваше имя
Author URI: https://metodkopilka.ru
Description: Тема для магазина текстовых материалов для педагогов
Version: 1.0.0
License: GPL v2 or later
Text Domain: metod-kopilka
*/

:root {
    --primary-blue: #2563eb;
    --secondary-blue: #3b82f6;
    --light-blue: #dbeafe;
    --primary-green: #10b981;
    --secondary-green: #34d399;
    --light-green: #d1fae5;
    --dark: #1f2937;
    --light: #f9fafb;
}

/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #f8fafc;
    color: var(--dark);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Шапка */
.site-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-green) 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-branding h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.site-branding p {
    margin: 5px 0 0 0;
    font-size: 1rem;
    opacity: 0.9;
}

.site-branding a {
    color: white;
    text-decoration: none;
}

.main-navigation ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 25px;
    position: relative;
}

.main-navigation li {
    position: relative;
}

.main-navigation a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    transition: opacity 0.3s;
    display: block;
    padding: 8px 15px;
    border-radius: 5px;
}

.main-navigation a:hover {
    opacity: 0.8;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Выпадающее меню каталога */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 300px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    padding: 15px 0;
    margin-top: 10px;
}

.dropdown-menu.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.dropdown-menu ul {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.dropdown-menu a {
    color: var(--dark);
    padding: 12px 20px;
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
}

.dropdown-menu a:hover {
    background-color: var(--light-blue);
    color: var(--primary-blue);
    border-left: 4px solid var(--primary-green);
    transform: translateX(5px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Основная структура */
.main-wrapper {
    display: flex;
    gap: 30px;
    margin-top: 30px;
    margin-bottom: 50px;
    flex: 1;
}

.main-content {
    flex: 3;
}

.sidebar {
    flex: 1;
    min-width: 280px;
}

/* Герой секция */
.hero-section {
    background: linear-gradient(135deg, var(--light-blue) 0%, var(--light-green) 100%);
    padding: 60px 40px;
    border-radius: 20px;
    text-align: center;
    margin-bottom: 40px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.15);
}

.hero-section h2 {
    color: var(--primary-blue);
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.hero-section p {
    color: var(--dark);
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.btn {
    display: inline-block;
    background: linear-gradient(to right, var(--primary-blue), var(--primary-green));
    color: white;
    padding: 14px 32px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    cursor: pointer;
    border: none;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* Новостные блоки */
.news-section {
    margin-top: 40px;
}

.news-section h2 {
    color: var(--primary-blue);
    font-size: 2rem;
    margin-bottom: 25px;
    border-bottom: 3px solid var(--secondary-green);
    padding-bottom: 10px;
    display: inline-block;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.news-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
    border-top: 5px solid var(--primary-green);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.news-card h3 {
    color: var(--primary-blue);
    margin-top: 0;
    font-size: 1.4rem;
    min-height: 60px;
}

.news-card p {
    color: #555;
    line-height: 1.6;
    flex-grow: 1;
    margin-bottom: 20px;
}

.news-date {
    display: inline-block;
    background: var(--light-green);
    color: var(--primary-green);
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    align-self: flex-start;
}

/* Боковая панель */
.sidebar-widget {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
    border-left: 5px solid var(--primary-blue);
    align-self: flex-start;
    position: sticky;
    top: 20px;
    margin-bottom: 30px;
}

.sidebar-widget h2 {
    color: var(--primary-blue);
    margin-top: 0;
    font-size: 1.8rem;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--light-blue);
}

.theme-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.theme-list li {
    margin-bottom: 12px;
}

.theme-list a {
    display: block;
    padding: 12px 18px;
    background: var(--light-blue);
    color: var(--primary-blue);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s ease;
    font-weight: 500;
    border-left: 4px solid transparent;
}

.theme-list a:hover {
    background: linear-gradient(to right, var(--light-blue), var(--light-green));
    color: var(--dark);
    transform: translateX(5px);
    border-left: 4px solid var(--primary-green);
}

/* Футер */
.site-footer {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-green) 100%);
    color: white;
    padding: 40px 0 20px;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer-section h3 {
    margin-top: 0;
    font-size: 1.3rem;
    margin-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
}

.footer-section p {
    margin: 10px 0;
    opacity: 0.9;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a {
    color: white;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.footer-section ul li a:hover {
    opacity: 1;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
    margin: 0;
    opacity: 0.8;
}

/* WordPress специфичные стили */
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.widget {
    margin-bottom: 30px;
}

/* ===========================================
   СТИЛИ ДЛЯ ШАБЛОННОЙ ЧАСТИ NEWS-SECTION.PHP
   =========================================== */

/* Секция новостей - шаблонная часть */
.news-section {
    margin: 60px 0;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f0f9ff 100%);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

/* Заголовок секции */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.section-title {
    color: var(--primary-blue);
    font-size: 2rem;
    margin: 0;
    position: relative;
    padding-bottom: 10px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(to right, var(--primary-blue), var(--primary-green));
    border-radius: 2px;
}

/* Кнопка "Все новости" */
.view-all-link {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.view-all-link:hover {
    color: var(--primary-green);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.15);
}

.view-all-link::after {
    content: '→';
    transition: transform 0.3s;
}

.view-all-link:hover::after {
    transform: translateX(5px);
}

/* Сетка новостей - шаблонная часть */
.news-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.news-grid-1 { grid-template-columns: 1fr; }
.news-grid-2 { grid-template-columns: repeat(2, 1fr); }
.news-grid-3 { grid-template-columns: repeat(3, 1fr); }
.news-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Карточка новости - шаблонная часть */
.news-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    height: 100%;
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.5s ease forwards;
}

.news-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.news-card:nth-child(1) { animation-delay: 0.1s; }
.news-card:nth-child(2) { animation-delay: 0.2s; }
.news-card:nth-child(3) { animation-delay: 0.3s; }
.news-card:nth-child(4) { animation-delay: 0.4s; }

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

/* Эффект при наведении на всю карточку */
.news-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: 15px;
    z-index: 1;
}

.news-card:hover::before {
    opacity: 1;
}

/* Изображение в карточке */
.news-card-image {
    height: 220px;
    overflow: hidden;
    position: relative;
}

.news-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

.news-card:hover .news-card-image img {
    transform: scale(1.1);
}

/* Наложение градиента на изображение */
.news-card-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(0,0,0,0.1), transparent);
}

/* Контент карточки */
.news-card-content {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

/* Мета-информация */
.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 0.85rem;
}

.news-date {
    color: var(--primary-green);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.news-date::before {
    content: '📅';
    font-size: 0.9rem;
}

.news-category {
    background: var(--light-blue);
    color: var(--primary-blue);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s;
}

.news-card:hover .news-category {
    background: var(--primary-blue);
    color: white;
}

/* Заголовок новости */
.news-card-title {
    margin: 0 0 15px 0;
    font-size: 1.3rem;
    line-height: 1.4;
    min-height: 66px;
}

.news-card-title a {
    color: var(--dark);
    text-decoration: none;
    transition: color 0.3s;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-title a:hover {
    color: var(--primary-blue);
}

/* Краткое описание */
.news-card-excerpt {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 0.95rem;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Ссылка "Читать далее" */
.news-read-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    padding: 8px 0;
    width: fit-content;
}

.news-read-more:hover {
    color: var(--primary-green);
    gap: 12px;
}

.news-read-more::after {
    content: '→';
    transition: transform 0.3s;
}

.news-read-more:hover::after {
    transform: translateX(5px);
}

/* Сообщение "Нет новостей" */
.news-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    background: white;
    border-radius: 15px;
    grid-column: 1 / -1;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.news-empty p {
    font-size: 1.1rem;
    margin: 0;
}

/* Дополнительные стили для существующих классов */
.news-date.old-style {
    background: var(--light-green);
    color: var(--primary-green);
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    align-self: flex-start;
}

/* Адаптивность для шаблонной части */
@media (max-width: 1100px) {
    .news-grid-3,
    .news-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .news-section {
        margin: 40px 0;
        padding: 30px 15px;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .news-card-image {
        height: 200px;
    }
    
    .main-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: static;
        margin-top: 40px;
    }
    
    .hero-section h2 {
        font-size: 2rem;
    }
    
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dropdown-menu {
        position: fixed;
        top: auto;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        text-align: center;
    }
    
    .main-navigation ul {
        flex-direction: column;
        gap: 15px;
        margin-top: 20px;
    }
    
    .hero-section {
        padding: 40px 20px;
    }
    
    .hero-section h2 {
        font-size: 1.8rem;
    }
    
    .news-grid {
        grid-template-columns: 1fr;
    }
    
    .dropdown-menu {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 95%;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .view-all-link {
        align-self: flex-start;
    }
    
    .news-grid,
    .news-grid-2,
    .news-grid-3,
    .news-grid-4 {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .news-card-image {
        height: 180px;
    }
    
    .news-card-content {
        padding: 20px;
    }
    
    .news-card-title {
        font-size: 1.2rem;
        min-height: auto;
    }
}

@media (max-width: 480px) {
    .news-section {
        padding: 25px 10px;
        margin: 30px 0;
    }
    
    .section-title {
        font-size: 1.6rem;
    }
    
    .news-card-image {
        height: 160px;
    }
    
    .news-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Стили для страницы "Все новости" (архива) */
.news-archive {
    margin: 40px 0;
}

.archive-header {
    text-align: center;
    margin-bottom: 50px;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--light-blue) 0%, var(--light-green) 100%);
    border-radius: 20px;
}

.archive-title {
    color: var(--primary-blue);
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.archive-description {
    color: var(--dark);
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
    opacity: 0.9;
}

/* Пагинация */
.pagination {
    margin-top: 60px;
    text-align: center;
}

.nav-links {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: white;
    color: var(--dark);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.page-numbers.current {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-green) 100%);
    color: white;
    transform: scale(1.1);
}

.page-numbers:hover:not(.current) {
    background: var(--light-blue);
    color: var(--primary-blue);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.15);
}

/* Эффект загрузки для карточек */
.news-card.loading {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Иконки для мета-информации */
.news-date i,
.news-comments i {
    margin-right: 5px;
}

/* Убедимся, что контент над градиентом */
.news-card > * {
    position: relative;
    z-index: 2;
}
// Редирект с /materials/ на /catalog/
add_action('template_redirect', function() {
    if (is_page('materials')) {
        wp_redirect(home_url('/catalog/'), 301);
        exit;
    }
}
/* Кнопка Оплата-Доставка */
.oplata-btn {
    display: block !important;
    background: white !important;
    color: #2563eb !important;
    text-decoration: none !important;
    padding: 12px !important;
    border-radius: 5px !important;
    font-weight: 600 !important;
    margin-top: 15px !important;
    text-align: center !important;
    border: 2px solid white !important;
    transition: all 0.3s ease !important;
}

.oplata-btn:hover {
    background: transparent !important;
    color: white !important;
    border-color: white !important;
});