@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&display=swap');

:root {
    --primary-color: #ff8c00;
    --secondary-color: #333;
    --background-color: #f9f9f9;
    --font-family: 'Open Sans', Arial, sans-serif;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --muted-color: #777;
}

/* Общие настройки */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--secondary-color);
    line-height: 1.7;
    overflow-x: hidden;
}

/* Контейнер */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

/* Шапка */
header.site-header {
  position: relative;
  width: 90%;
  max-width: 1150px;
  margin: 40px auto 0;
  padding: 20px 20px;
  border-radius: var(--border-radius);
  overflow: hidden;
    z-index: 2000;
  /* Анимированный градиент */
  background: linear-gradient(90deg, #ffe5d0, #ff8c00, #ff9a00);
  background-size: 200% 200%;
  animation: gradientBG 15s ease infinite;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Градиентная анимация */
@keyframes gradientBG {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Анимация логотипа */
@keyframes logoBounce {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -55%) scale(1.05);
  }
}

/* Логотип */
header.site-header .logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 220px;
  height: 50px;
  background-color: var(--primary-color);
  border-radius: 25px;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: logoBounce 6s ease-in-out infinite;
}
header.site-header .logo:hover {
  transform: translate(-50%, -50%) rotate(-2deg) scale(1.1);
  box-shadow: 0 0 20px rgba(255, 140, 0, 0.8);
}

/* Навигация */
header.site-header nav ul {
  display: flex;
  list-style: none;
  gap: 50px;
}
header.site-header nav ul li {
  position: relative;
}
header.site-header nav ul li a {
  color: var(--secondary-color);
  font-size: 0.9rem;
  font-weight: 900;
  text-transform: uppercase;
  text-decoration: none;
  padding: 4px 0;
  transition: color 0.3s ease;
  position: relative;
}
header.site-header nav ul li a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width 0.3s ease, left 0.3s ease;
}
header.site-header nav ul li a:hover {
  color: var(--primary-color);
}
header.site-header nav ul li a:hover::after {
  width: 100%;
  left: 0;
}

/* Отключение сложных анимаций на мобильных */
@media (max-width: 768px) {
  header.site-header {
    animation: none;
  }
  header.site-header::after {
    display: none;
  }
}

/* Основное содержимое */
.page-content {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px auto;
}

.main-content {
    flex: none;
    width: 65%;
}

/* =========================
   Стили для карточек историй
   ========================= */
#stories-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.story-card {
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.story-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.story-link {
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
}

.story-thumb {
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    position: relative;
    overflow: hidden;
    background-color: #eee;
}

.story-thumb img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

.story-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 12px 12px 8px;
    line-height: 1.3;
    color: var(--secondary-color);
}

.story-excerpt {
    font-size: 0.875rem;
    color: var(--muted-color);
    margin: 0 12px 12px;
    line-height: 1.4;
    flex-grow: 1;
    overflow: hidden;
}

/* =============================================================================
   Пагинация: компактный стиль
   ============================================================================= */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin: 20px 0;
    font-family: var(--font-family);
}

.pagination button,
.pagination span {
    padding: 4px 8px;
    font-size: 0.875rem;
    border: 1px solid #ddd;
    background: #fff;
    color: var(--secondary-color);
    border-radius: 6px;
    min-width: 32px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.pagination button:hover:not(.active):not(:disabled) {
    background: var(--background-color);
}

.pagination button:disabled {
    color: var(--muted-color);
    cursor: default;
}

.pagination button.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.pagination .ellipsis {
    border: none;
    background: transparent;
    cursor: default;
    color: var(--muted-color);
}

@media (max-width: 600px) {
    .pagination {
        gap: 2px;
        margin: 12px 0;
    }
    .pagination button,
    .pagination span {
        padding: 3px 6px;
        font-size: 0.8rem;
        min-width: 28px;
    }
}


/* Секция отзывов */
.testimonials-section {
    background: #eef3f8;
    padding: 80px 20px;
    position: relative;
    overflow: hidden;
}

testimonials-section::before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 200px;
    height: 200px;
    background: var(--primary-color);
    opacity: 0.1;
    border-radius: 50%;
}

testimonials-section h2 {
    text-align: center;
    font-size: 2em;
    color: var(--secondary-color);
    margin-bottom: 50px;
    position: relative;
}

testimonials-section h2::after {
    content: '';
    display: block;
    width: 70px;
    height: 4px;
    background: var(--primary-color);
    margin: 16px auto 0;
    border-radius: 2px;
}

testimonials {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

testimonial-card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 25px;
    max-width: 280px;
    flex: 1 1 250px;
    transition: var(--transition);
    cursor: pointer;
}

testimonial-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow);
}

testimonial-text {
    font-style: italic;
    color: var(--muted-color);
    margin-bottom: 20px;
}

testimonial-author {
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
}

/* Футер */
footer.site-footer {
    background: var(--primary-color);
    color: #fff;
    text-align: center;
    padding: 15px 0;
    font-size: 0.95em;
    margin-top: 40px;
}

/* Адаптивность */
@media (max-width: 992px) {
    .page-content {
        flex-direction: column;
        align-items: center;
    }
    .main-content {
        width: 100%;
    }
    header.site-header .container {
        height: auto;
    }
    .testimonials {
        gap: 16px;
    }
}

@media (max-width: 768px) {
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    .container {
        justify-content: center;
    }
    #stories-container {
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .testimonial-card {
        max-width: 100%;
    }
    #stories-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .story-title {
        font-size: 1rem;
    }
    .story-excerpt {
        font-size: 0.85rem;
    }
    .pagination button {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
}

/* Индикатор загрузки */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted-color);
    font-style: italic;
    font-size: 1.1rem;
    position: relative;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Анимация плавного появления контента */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Стили для ошибок загрузки */
.error-message {
    text-align: center;
    padding: 40px 20px;
    color: #d32f2f;
    background-color: #ffebee;
    border-radius: var(--border-radius);
    margin: 20px 0;
    font-weight: 600;
}

/* =============================================================================
   MGID Рекламный виджет - нативный дизайн
   ============================================================================= */
.mgid-widget-container {
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--border-radius);
    padding: 18px;
    margin: 25px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(255, 140, 0, 0.08);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out;
    transition: var(--transition);
}

.mgid-widget-container:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.mgid-widget-container::before {
    content: 'Спонсируемое';
    position: absolute;
    top: 6px;
    right: 12px;
    font-size: 0.65rem;
    color: rgba(255, 140, 0, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    opacity: 0.8;
    background: rgba(255, 140, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.mgid-widget-container [data-type="_mgwidget"] {
    width: 100%;
    min-height: 180px;
    border-radius: 8px;
    overflow: hidden;
}

/* Адаптивность для рекламного виджета */
@media (max-width: 768px) {
    .mgid-widget-container {
        margin: 20px 0;
        padding: 15px;
    }
    
    .mgid-widget-container::before {
        font-size: 0.6rem;
        top: 5px;
        right: 10px;
        padding: 1px 4px;
    }
    
    .mgid-widget-container [data-type="_mgwidget"] {
        min-height: 150px;
    }
}

/* === Bottom Banner === */
.bottom-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 50vh;
    background: linear-gradient(135deg, var(--primary-color), #ff6b35);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    visibility: visible; /* Убеждаемся что баннер видим */
    opacity: 1; /* Убеждаемся что баннер не прозрачный */
}

.bottom-banner.show {
    transform: translateY(0);
}

.banner-header {
    position: relative;
    padding: 16px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.banner-title {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.banner-hide-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.banner-hide-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.banner-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.banner-content::-webkit-scrollbar {
    width: 6px;
}

.banner-content::-webkit-scrollbar-track {
    background: transparent;
}

.banner-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.banner-widget {
    width: 100%;
    min-height: 200px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

/* Overlay для затемнения фона когда баннер активен - УДАЛЕНО */
/* .banner-overlay убран - затемнение фона не нужно */

/* Адаптивность баннера */
@media (max-width: 768px) {
    .bottom-banner {
        height: 60vh;
    }
    
    .banner-title {
        font-size: 1.1rem;
    }
    
    .banner-content {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .bottom-banner {
        height: 70vh;
    }
    
    .banner-header {
        padding: 8px;
    }
    
    .banner-title {
        font-size: 1rem;
    }
    
    .banner-hide-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* Анимация появления баннера */
@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.bottom-banner.animate-in {
    animation: slideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}