:root {
  --primary: #2d78c8;
  --primary-light: #3c92e8;
  --primary-dark: #1e5ea8;
  --accent-gray: #80878e;
  --light-bg: #F8F9FA;
  --dark-text: #212529;
  --border-color: #CCDCEC;
  --module-bg: #FFFFFF;
}

* {
  box-sizing: border-box;
}

body.site {
  font-family: 'Times New Roman', serif;
  margin: 0;
  padding: 0;
  color: var(--dark-text);
  background-color: var(--light-bg);
  position: relative;
  z-index: 1;
  line-height: 1.5;
  min-width: 320px;
}

/* Фоновое изображение */
#background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../images/sunshine.jpg');
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  z-index: -1;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* ОБНОВЛЕННЫЙ CSS GRID С ПОДДЕРЖКОЙ ШИРОКИХ ЭКРАНОВ */
#content-wrapper {
    display: grid;
    grid-template-columns: var(--col-left-width) 1fr var(--col-right-width);
    grid-template-areas: "left center right";
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: 20px auto;
    width: calc(100% - 40px);
    align-items: start;
}

#left-col {
    grid-area: left;
    min-width: 0;
    width: 100%;
}

#center-col {
    grid-area: center;
    min-width: 0;
}

#right-col {
    grid-area: right;
    min-width: 0;
    width: 100%;
}

/* АДАПТИВНЫЕ МОДУЛИ */
.moduletable, #header, .component-content {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--module-bg);
  padding: 0;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  width: 100%;
  min-width: 0;
}

/* ГИБКИЕ МОДУЛИ ДЛЯ БОКОВЫХ КОЛОНОК */
#left-col .moduletable,
#right-col .moduletable {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Градиент для заголовков модулей */
.moduletable h3,
#header h3 {
  background: linear-gradient(to top, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%) !important;
  color: white;
  font-weight: bold;
  font-size: 14px;
  padding: 12px 15px;
  margin: 0;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.module-content, #header-content, .component-content > * {
  padding: 15px;
  min-width: 0;
  overflow-wrap: break-word;
}

/* Разделитель между статьями */
.component-content .article-item + .article-item {
  border-top: 1px solid #888;
  margin-top: 20px;
  padding-top: 20px;
}

/* Футер */
#footer {
  background-color: #212529;
  color: white;
  padding: 20px 0;
  margin-top: 40px;
  text-align: center;
  width: 100%;
}

/* УЛУЧШЕННАЯ АДАПТИВНОСТЬ ДЛЯ ШИРОКИХ ЭКРАНОВ */
@media (min-width: 1401px) {
    #content-wrapper {
        max-width: 1400px;
    }
}

@media (max-width: 1400px) {
    #content-wrapper {
        max-width: 1200px;
        padding: 20px;
    }
}

@media (max-width: 1200px) {
    #content-wrapper {
        grid-template-columns: minmax(200px, var(--col-left-width)) 1fr minmax(150px, var(--col-right-width));
        gap: 15px;
        padding: 15px;
        max-width: 100%;
    }
}

@media (max-width: 992px) {
    #content-wrapper {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "center"
            "left" 
            "right";
        gap: 15px;
    }
    
    #left-col,
    #right-col {
        width: 100%;
        min-width: 100%;
    }
    
    /* МОДУЛИ ЗАНИМАЮТ ВСЮ ШИРИНУ НА МОБИЛЬНЫХ */
    #left-col .moduletable,
    #right-col .moduletable {
        width: 100%;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    #content-wrapper {
        padding: 10px;
        width: calc(100% - 20px);
        gap: 10px;
    }
    
    .moduletable {
        margin-bottom: 15px;
    }
    
    .module-content, #header-content, .component-content > * {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .module-content, #header-content, .component-content > * {
        padding: 8px;
    }
    
    .moduletable h3 {
        font-size: 13px;
        padding: 10px 12px;
    }
}

/* ГИБКИЕ ИЗОБРАЖЕНИЯ И ТАБЛИЦЫ */
.component-content img {
    max-width: 100%;
    height: auto;
    display: block;
}

.component-content table {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

.component-content iframe,
.component-content video {
    max-width: 100%;
    height: auto;
}
/* БАННЕРЫ */
#banner-top,
#banner-bottom {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

#banner-top {
  margin-bottom: 20px;
}

#banner-bottom {
  margin-top: 20px;
}

/* ФУТЕР КАК МОДУЛЬ */
#footer {
  background-color: #212529;
  color: white;
  padding: 30px 0;
  margin-top: 40px;
  width: 100%;
}

#footer .moduletable {
  background: transparent;
  border: none;
  box-shadow: none;
  margin-bottom: 0;
}

#footer .moduletable h3 {
  color: white;
  background: transparent !important;
  text-align: left;
  border: none;
}

#footer .module-content {
  color: #ccc;
  line-height: 1.6;
}

/* Резервный футер */
.footer-default {
  text-align: center;
  color: #ccc;
  font-size: 14px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* АДАПТИВНОСТЬ ДЛЯ НОВЫХ ПОЗИЦИЙ */
@media (max-width: 768px) {
  #banner-top,
  #banner-bottom {
    padding: 0 10px;
  }
  
  #banner-top {
    margin-bottom: 15px;
  }
  
  #banner-bottom {
    margin-top: 15px;
  }
  
  #footer {
    padding: 20px 0;
    margin-top: 30px;
  }
  
  .footer-default {
    padding: 0 10px;
    font-size: 13px;
  }
}
/* ОБЕСПЕЧИВАЕМ СТИЛИ ДЛЯ ВСЕХ МОДУЛЕЙ В БОКОВЫХ КОЛОНКАХ */
#left-col .moduletable,
#left-col .module,
#right-col .moduletable, 
#right-col .module {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--module-bg);
  padding: 0;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  width: 100%;
}

/* Заголовки модулей в боковых колонках */
#left-col .moduletable h3,
#left-col .module h3,
#right-col .moduletable h3,
#right-col .module h3 {
  background: linear-gradient(to top, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%) !important;
  color: white;
  font-weight: bold;
  font-size: 14px;
  padding: 12px 15px;
  margin: 0;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Контент модулей */
#left-col .moduletable div,
#left-col .module div,
#right-col .moduletable div,
#right-col .module div {
  padding: 15px;
}