/* Основные стили плагина Problems в стиле темы Hexa */
.problems__container {
    font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;
    max-width: 1200px;
    margin: 28.8px auto;
    padding: 0;
    line-height: 1.6em;
}

/* Панель администратора */
.problems__admin-panel {
    background: #5a7171;
    color: white;
    padding: 14.4px 28.8px;
    border-radius: 0;
    margin-bottom: 28.8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 8px solid #8BC34A;
    animation: slideDown 0.5s ease;
}

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

.problems__admin-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 0;
    font-size: 0.77778em;
    line-height: 2.05714em;
    font-weight: bold;
    text-transform: uppercase;
}

.problems__admin-exit {
    color: white;
    text-decoration: none;
    background: #8BC34A;
    padding: 6px 16px;
    border-radius: 0;
    font-size: 0.77778em;
    line-height: 2.05714em;
    transition: all 0.3s ease-in-out;
    text-transform: uppercase;
}

.problems__admin-exit:hover {
    background: #6a524a;
    color: white;
}

.problems__nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14.4px;
    flex-wrap: wrap;
    gap: 10px;
}

.problems__admin-controls {
    display: flex;
    gap: 10px;
}

/* Структура */
.problems__structure {
    margin-top: 28.8px;
}

.problems__structure-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28.8px;
    flex-wrap: wrap;
    gap: 14.4px;
}

.problems__structure-header .problems__subject-title {
    margin-bottom: 0;
    flex: 1;
}

.problems__expand-all {
    background: #5a7171;
    color: rgba(255, 255, 255, 0.8);
    border: none;
    padding: 10.8px 21.6px;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.77778em;
    line-height: 2.05714em;
    transition: all 0.3s ease-in-out;
    text-transform: uppercase;
    font-weight: bold;
    white-space: nowrap;
}

.problems__expand-all:hover {
    background: #8BC34A;
    color: white;
}

.problems__subject-title {
    color: #000000;
    font-size: 1.44444em;
    line-height: 2.21538em;
    border-bottom: 1px solid #5a7171;
    padding-bottom: 14.4px;
    margin-bottom: 28.8px;
}

/* Блоки с аккордеоном */
.problems__block {
    background: #f4f3f1;
    border-radius: 0;
    margin-bottom: 14.4px;
    border-left: 8px solid #5a7171;
    transition: all 0.3s ease-in-out;
    overflow: hidden;
}

.problems__block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 21.6px 28.8px;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
}

.problems__block-header:hover {
    background: #f8f9fa;
}

.problems__block-header.expanded {
    background: #f0f0f0;
}

.problems__block-title {
    color: #5a7171;
    margin: 0;
    font-size: 1.22222em;
    line-height: 1.30909em;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.problems__block-arrow {
    font-size: 1.5em;
    line-height: 1;
    transition: transform 0.3s ease-in-out;
    color: #8BC34A;
}

.problems__block-header.expanded .problems__block-arrow {
    transform: rotate(180deg);
}

.problems__block-number {
    color: #8BC34A;
    font-weight: bold;
    font-size: 0.9em;
}

.problems__themes-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out, padding 0.3s ease-in-out;
    background: white;
}

.problems__block.expanded .problems__themes-wrapper {
    max-height: 1000px;
    padding: 0 28.8px 28.8px;
}

.problems__themes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 14.4px;
}

.problems__theme-link {
    display: inline-block;
    background: white;
    color: #000 !important;
    text-decoration: none !important;
    padding: 8px 16px;
    border-radius: 0;
    border: 1px solid #5a7171;
    transition: all 0.3s ease-in-out;
    font-size: 14px;
    line-height: 16px;
    flex: 1;
    min-width: 200px;
    text-align: center;
}

.problems__theme-link:hover {
    background: #5a7171;
    color: white !important;
    transform: translateY(-2px);
    border-color: #5a7171;
}

/* Задачи */
.problems__header {
    background: white;
    padding: 28.8px;
    border-radius: 0;
    margin-bottom: 28.8px;
    border-left: 8px solid #5a7171;
}

.problems__back-link {
    color: #5a7171 !important;
    text-decoration: none !important;
    font-size: 0.77778em;
    line-height: 2.05714em;
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #5a7171 !important;
    border-radius: 0;
    transition: all 0.3s ease-in-out;
}

.problems__back-link:hover {
    color: #8BC34A;
    border-color: #8BC34A;
    background: #fdf2f2;
}

.problems__theme-title {
    color: #5a7171;
    margin: 21.6px 0;
    padding-bottom: 14.4px;
    border-bottom: 1px solid #e9e7e3;
    font-size: 1.22222em;
    line-height: 1.30909em;
    font-weight: bold;
}

.problems__toggle-all {
    background: #5a7171;
    color: rgba(255, 255, 255, 0.8);
    border: none;
    padding: 14.4px 28.8px;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.77778em;
    line-height: 2.05714em;
    transition: all 0.3s ease-in-out;
    margin-top: 14.4px;
    text-transform: uppercase;
    font-weight: bold;
}

.problems__toggle-all:hover {
    background: #8BC34A;
    color: white;
}

/* Элемент задачи */
.problems__item {
    background: white;
    border-radius: 0;
    padding: 28.8px;
    margin-bottom: 28.8px;
    border-left: 8px solid #5a7171;
    transition: all 0.3s ease-in-out;
}

.problems__item:hover {
    border-left-color: #5a7171;
}

.problems__question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 21.6px;
    flex-wrap: wrap;
    gap: 10px;
}

.problems__problem-number {
    font-weight: bold;
    color: #5a7171;
    background: #ebf5fb;
    padding: 4px 12px;
    border-radius: 0;
    font-size: 0.77778em;
    line-height: 2.05714em;
    text-transform: uppercase;
}

.problems__admin-btn {
    background: #8BC34A;
    color: rgba(255, 255, 255, 0.8);
    border: none;
    padding: 8px 16px;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.77778em;
    line-height: 2.05714em;
    transition: all 0.3s ease-in-out;
    text-transform: uppercase;
    font-weight: bold;
}

.problems__admin-btn:hover {
    background: #6c7b7d;
    color: white;
}

.problems__question-content {
    line-height: 1.6;
    color: #222;
}

.problems__question-content img {
    max-width: 100%;
    height: auto;
    margin: 14.4px 0;
}

.problems__question-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 14.4px 0;
}

.problems__question-content table th {
    background: #f8f9fa;
    font-weight: bold;
}

.problems__question-content table th,
.problems__question-content table td {
    border: 1px solid #e9e7e3;
    padding: 12px;
    text-align: left;
}

.problems__question-content pre {
    background: #f4f3f1;
    color: #222;
    padding: 14.4px;
    border-radius: 0;
    overflow-x: auto;
    margin: 14.4px 0;
    font-family: "Courier 10 Pitch", Courier, monospace;
    font-size: 0.77778em;
    line-height: 2.05714em;
}

.problems__question-content code {
    background: #f4f3f1;
    padding: 2px 6px;
    border-radius: 0;
    font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;
    color: #8BC34A;
    font-size: 0.77778em;
    line-height: 2.05714em;
}

.problems__question-content blockquote {
    color: #97756a;
    font-size: 1.22222em;
    line-height: 1.30909em;
    border-left: 5px solid #8BC34A;
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 28.8px;
    padding-left: 28.8px;
}

/* Решение */
.problems__solution {
    margin-top: 28.8px;
    border-top: 1px dashed #e9e7e3;
    padding-top: 28.8px;
}

.problems__show-solution {
    background: #5a7171;
    color: rgba(255, 255, 255, 0.8);
    border: none;
    padding: 14.4px 28.8px;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    font-size: 0.77778em;
    line-height: 2.05714em;
    font-weight: bold;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

.problems__show-solution::before {
    content: "↓";
    font-size: 1.1em;
    transition: transform 0.3s ease;
}

.problems__show-solution:hover {
    background: #8BC34A;
    color: white;
}

.problems__item.expanded .problems__show-solution::before {
    transform: rotate(180deg);
}

.problems__answer {
    margin-top: 28.8px;
    padding: 28.8px;
    background: #f8f9fa;
    border-radius: 0;
    border-left: 1px solid #5a7171;
    animation: fadeIn 0.5s ease;
}

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

/* Состояния */
.problems__item.expanded .problems__answer {
    display: block !important;
}

.problems__item.expanded .problems__show-solution {
    background: #6c7b7d;
}

.problems__item.expanded .problems__show-solution:hover {
    background: #6c7b7d;
}

/* Пустой контейнер */
.problems__empty {
    text-align: center;
    padding: 57.6px;
    color: #a69e8d;
    background: #f4f3f1;
    border-radius: 0;
    font-size: 1.22222em;
    line-height: 1.30909em;
    border: 2px dashed #e9e7e3;
}

/* Ошибка */
.problems__error {
    color: #8BC34A;
    background: #fdf2f2;
    padding: 28.8px;
    border-radius: 0;
    border-left: 3px solid #8BC34A;
    margin: 14.4px 0;
    font-size: 1.22222em;
    line-height: 1.30909em;
}

/* Фиксированная кнопка "Назад к списку тем" */
.problems__back-fixed {
    position: fixed;
    bottom: 60px;
    right: 20px;
    background: #5a7171;
    color: rgba(255, 255, 255, 0.8) !important;
    border: none;
    padding: 14.4px 21.6px;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.77778em;
    line-height: 2.05714em;
    transition: all 0.3s ease-in-out;
    text-transform: uppercase;
    font-weight: bold;
    z-index: 999;
    display: none;
    text-decoration: none;
    border-left: 0px solid #8BC34A;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.problems__back-fixed:hover {
    background: #8BC34A;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.problems__back-fixed.show {
    display: block;
    animation: fadeInUp 0.3s ease;
    font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;
}

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

/* Адаптивность */
@media screen and (max-width: 48.81em) {
    .problems__question-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14.4px;
    }

    .problems__answer {
        margin-top: 15px;
        padding: 10px;
    }

    .problems__admin-btn {
        align-self: stretch;
        text-align: center;
    }

    .problems__themes {
        justify-content: center;
    }

    .problems__theme-link {
        flex: 1;
        min-width: 150px;
        text-align: center;
    }

    .problems__nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 14.4px;
    }

    .problems__admin-controls {
        align-self: stretch;
    }

    .problems__admin-exit {
        display: block;
        text-align: center;
    }

    .problems__block,
    .problems__header,
    .problems__item {
        padding: 10px;
    }

    .problems__block-header {
        padding: 14.4px;
    }

    .problems__block.expanded .problems__themes-wrapper {
        padding: 0 14.4px 14.4px;
    }

    .problems__structure-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .problems__expand-all {
        align-self: stretch;
        text-align: center;
    }
}

/* Адаптивность для фиксированной кнопки */
@media screen and (max-width: 48.81em) {
    .problems__back-fixed {
        bottom: 50px;
        right: 10px;
        padding: 10.8px 16.2px;
        font-size: 0.66667em;
    }
}

/* Если есть кнопка #toTop, размещаем их рядом */
#toTop + .problems__back-fixed {
    bottom: 110px;
}

@media screen and (max-width: 48.81em) {
    #toTop + .problems__back-fixed {
        bottom: 90px;
    }
}

/* Стили для контента внутри ответов (наследуем стили темы) */
.problems__answer p {
    margin-bottom: 24px;
}

.problems__answer ul,
.problems__answer ol {
    margin: 0 0 24px 36px;
}

.problems__answer ul {
    list-style: disc;
}

.problems__answer ol {
    list-style: decimal;
}

.problems__answer li > ul,
.problems__answer li > ol {
    margin-bottom: 0;
    margin-left: 24px;
}

.problems__answer h1,
.problems__answer h2,
.problems__answer h3,
.problems__answer h4,
.problems__answer h5,
.problems__answer h6 {
    color: #5a7171;
    margin: 28.8px 0;
    line-height: 1.2em;
    font-size: 16px;
}

.problems__answer a {
    color: #8BC34A;
    text-decoration: none;
    transition: all 0.3s ease-in-out;
}

.problems__answer a:hover {
    color: #6a524a;
}

/* Дополнительные стили для аккордеона */
.problems__block-arrow {
    display: inline-block;
    transition: transform 0.3s ease-in-out;
    margin-left: auto;
    font-size: 0.9em;
    color: #8BC34A;
    min-width: 20px;
    text-align: center;
}

.problems__block-header.expanded .problems__block-arrow {
    transform: rotate(180deg);
}

.problems__block-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
}

.problems__block-number {
    color: #8BC34A;
    font-weight: bold;
    white-space: nowrap;
}

.problems__block-name {
    flex: 1;
    text-align: left;
}


/* Панель управления доской */
.problems__board-controls {
    background: #f8f9fa;
    border: 2px solid #5a7171;
    border-left: 8px solid #8BC34A;
    padding: 15px;
    margin: 20px 0;
    position: relative;
    animation: slideDown 0.3s ease;
}

.problems__board-controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9e7e3;
}

.problems__board-title {
    color: #5a7171;
    font-weight: bold;
    font-size: 1.1em;
}

.problems__board-close {
    background: #ff6b6b;
    color: white;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.problems__board-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.problems__board-btn {
    padding: 12px 15px;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    transition: all 0.3s ease;
    color: white;
}

.problems__board-show-answer {
    background: #5a7171;
}

.problems__board-show-solution {
    background: #4a6fa5;
}

.problems__board-hide {
    background: #f39c12;
}

.problems__board-remove {
    background: #e74c3c;
}

.problems__board-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Адаптивность для панели управления */
@media screen and (max-width: 768px) {
    .problems__board-buttons {
        grid-template-columns: 1fr;
    }

    .problems__board-controls {
        padding: 10px;
    }

    .problems__board-btn {
        padding: 10px;
    }
    .problems__block-title {
        font-size: 10px;
        line-height: 14px;
    }
}