/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    font-family: 'DreiFraktur';
    src: url('../fonts/DreiFraktur.ttf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Anticva';
    src: url('../fonts/Anticva.ttf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Bookerly Ligth';
    src: url('../fonts/Bookerly Light.ttf') format('opentype');
    font-weight: 100;
    font-style: normal;
}

@font-face {
    font-family: 'Bookerly Bold';
    src: url('../fonts/Bookerly Bold.ttf') format('opentype');
    font-weight: 700;
    font-style: normal;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Шапка */
header {
    background: url(../img/header_back.jpg);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    font-family: 'DreiFraktur';
}


header h1 {
    margin: 0;
    font-size: 1.5rem;
}

header a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: #e74c3c;
    border-radius: 4px;
}

/* Навигация */
.main-tabs {
    background: #34495e;
    display: flex;
    padding: 0 2rem;
    font-family: 'DreiFraktur';
}

.main-tabs a {
    color: white;
    padding: 1rem 2rem;
    text-decoration: none;
    transition: background 0.3s;
}


.main-tabs a:hover {
    background: #878787;
}

.sub-tabs {
    background: #ecf0f1;
    display: flex;
    padding: 0 2rem;
    flex-wrap: wrap;
    font-family: 'DreiFraktur';
}

.sub-tabs a {
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    color: #2c3e50;
    transition: background 0.3s;
}

.sub-tabs a:hover {
    background: #bdc3c7;
}

/* Контент */
.tiles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 2fr));
    gap: 20px;
    margin-top: 20px;
}

.content-tile {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.content-tile h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    padding-bottom: 5px;
}

/* Галерея изображений */
.image-gallery {
    position: relative;
    margin-bottom: 15px;
}

.gallery-item {
    display: none;
}

.gallery-item.active {
    display: table;
    margin: auto;
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-item img:hover {
    transform: scale(1.02);
}

.gallery-item img.selected {

    transform: scale(1.05);
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-nav.prev {
    left: 10px;
}

.gallery-nav.next {
    right: 10px;
}

/* Текстовые области */
.content-textarea {
    width: 100%;
    min-height: 600px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    margin-bottom: 15px;
    font-family: Bookerly Ligth;
    font-size: 17px;
}

/* Кнопки */
.save-btn, .update-btn, .delete-btn {
    padding: 15px 15px 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
}

.save-btn {
    background: #27ae60;
    color: white;
}

.update-btn {
    background: #34495e;
    color: white;
    font-family: 'DreiFraktur';
}

.delete-btn {
    background: #a62f23;
    color: white;
    font-family: 'DreiFraktur';
}

.save-btn:hover { background: #4e7295; }
.update-btn:hover { background: #4e7295; }
.delete-btn:hover { background: #c0392b; }

.action-buttons {
    display: flex;
    gap: 10px;
}

/* Викторины */
.quiz-content .question {
    font-weight: bold;
    margin-bottom: 15px;
    line-height: 1.5;
    min-height: 135px;
}

.quiz-content .options {
    margin: 10px 0;
}

.quiz-content .option {
    padding: 5px;
    margin: 2px 0;
    background: #f8f9fa;
    border-left: 3px solid #3498db;
}

.quiz-content .correct-answer {
    font-weight: bold;
    color: #27ae60;
    margin: 10px 0;
}

.quiz-content .explanation {
    font-style: italic;
    color: #555555;
    margin-bottom: 20px;
    margin-top: 10px;
    min-height: 100px;
}

/* Расписание */
.schedule-controls {
    margin: 20px 0;
    display: flex;
    gap: 15px;
    align-items: center;
}

.schedule-controls select,
.schedule-controls button {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.schedule-controls button {
    background: #34495e;
    color: white;
    cursor: pointer;
}

.schedule-item {
    background: white;
    padding: 20px;
    margin: 15px 0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.time-slots {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.time-slot {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.time-slot .time {
    font-weight: bold;
    min-width: 100px;
}

.time-slot .type {
    color: #7f8c8d;
    min-width: 120px;
}

.time-slot .post-id {
    flex: 1;
}

.replace-btn {
    padding: 5px 10px;
    background: #f39c12;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.replace-btn:hover {
    background: #e67e22;
}

/* Сообщения */
.loading, .no-content, .error {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
    font-style: italic;
}

.error {
    color: #e74c3c;
}

/* Авторизация */
.login-body {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: url(../img/back.jpg);
    background-position: center;
    background-size: cover;
    backdrop-filter: brightness(0.6);
}

.login-container {
    background: #ffffff6b;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: white;
    font-family: DreiFraktur;
    font-size: 34px;
}

.login-container input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-family: 'DreiFraktur';
}

.login-container button {
    width: 100%;
    padding: 12px;

    color: white;

    border-radius: 4px;

    cursor: pointer;
    margin-top: 10px;
    background: #fefefe;
    font-family: 'DreiFraktur';
    background: transparent;
    border: 1px solid;
    font-size: 22px;
}

.login-container button:hover {
    background: white;
    color:black;
    border: 1px solid transparent;
}

/* Добавьте эти стили в ваш файл style.css */

.tiles-container{
    font-family: 'Anticva';
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    gap: 15px;
}

.pagination-btn {
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'DreiFraktur'
}

.pagination-btn:hover:not(:disabled) {
    background-color: #34495e;
    color: white;
}

.pagination-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    font-family: 'DreiFraktur'
}

#page-info, #page-info-bottom {
    font-weight: bold;
    color: #333;
    font-family: 'Anticva';
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #666;
}

.no-content {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #999;
}

.error {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #dc3545;
}

.content-tile img{
    width: 100%;
    margin-bottom: 10px;
}

.image-gallery {
    position: relative;
    margin: 10px 0;
}

.gallery-item {
    display: none;
}

.gallery-item.active {
    display: block;
}

.image-gallery img {
    max-width: 100%;
    height: auto;
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

/*.image-gallery img.selected {*/
/*    border: 3px solid #007bff;*/
/*    box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);*/
/*}*/

.quiz-content{
    font-family: Bookerly Ligth;
}

.qoutes_counts{
    display: block;
    text-align: center;
}

.citates-textarea{
    min-height: 130px !important;
    cursor: not-allowed !important;
    user-select: none !important;
    font-style: italic;
    max-height: 117px;
    outline: none !important;
    box-shadow: none !important;
    height: 119px;
    border: none;
}

.days-textarea{
    min-height: 200px;
    border: none;
}

.gallery-nav {
    position: absolute;
    top: 90%;
    transform: translateY(-50%);
    color: #34495e;
    padding: 5px 10px 10px 10px;
    cursor: pointer;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: 4px solid #34495e;
    font-size: 26px;
}

.gallery-nav.prev {
    left: 10px;
}

.gallery-nav.next {
    right: 10px;
}

.gallery-nav:hover {
    background: rgb(52 73 94);
    color: white;
}

/* Стили для активных вкладок */
.main-tabs a.active {
    background: #b36642 !important;
    font-weight: bold;
}

.sub-tabs a.active {
    background: #874e34 !important;
    color: white !important;
    font-weight: bold;
}

/* Для мобильной версии */
@media (max-width: 768px) {
    /*.main-tabs a.active {*/
    /*    background: #999c28 !important;*/
    /*    border-radius: 4px;*/
    /*}*/

    /*.sub-tabs a.active {*/
    /*    background: #697524 !important;*/
    /*    color: white !important;*/
    /*    border-radius: 4px;*/
    /*}*/
}

.content-tile {
    border: 1px solid #ddd;
    padding: 15px;
    margin: 10px 0;
    border-radius: 5px;
    background: white;
}

/*.content-textarea {*/
/*    width: 100%;*/
/*    min-height: 100px;*/
/*    margin: 10px 0;*/
/*    padding: 8px;*/
/*    border: 1px solid #ccc;*/
/*    border-radius: 4px;*/
/*    resize: vertical;*/
/*}*/

.save-btn {
    background: #34495e;
    color: white;
    border: none;
    padding: 13px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'DreiFraktur';
}

.save-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}


.pagination-btn {
    padding: 8px 16px;
    border: 1px solid #34495e;
    background: white;
    color: #34495e;
    border-radius: 4px;
    cursor: pointer;
}

.pagination-btn:disabled {
    border-color: #ccc;
    color: #ccc;
    cursor: not-allowed;
}

.loading, .no-content, .error {
    text-align: center;
    padding: 20px;
    font-size: 18px;
    color: #666;
}


/* Мобильная адаптация */
@media (max-width: 768px) {
    .container {
        padding: 10px !important;
    }

    /* Одна плитка на экране */
    .tiles-container {
        grid-template-columns: 1fr !important;
        display: grid !important;
        gap: 15px;
    }

    /* Вертикальное расположение кнопок */
    .action-buttons {
        flex-direction: column !important;
        gap: 8px;
    }

    .save-btn, .update-btn, .delete-btn {
        width: 100% !important;
        margin-bottom: 5px;
    }

    /* Адаптация пагинации */
    .pagination-controls {
        flex-direction: row;
        gap: 0px;
        margin: 18px 0;
    }

    .pagination-btn {
        width: 100%;
        margin: 5px 0;
        font-size: 16px !important;
        padding: 12px !important;
    }

    /* Адаптация галереи */
    .gallery-item img {
        /*height: 350px !important;*/
        height: auto !important;
    }

    .gallery-nav {
        width: 35px !important;
        height: 35px !important;
        font-size: 16px !important;
        top: 90% !important;
    }

    /* Адаптация текстовых областей */
    .content-textarea {

        font-size: 16px !important;
    }

    /* Адаптация викторин */
    .quiz-content .question {
        min-height: auto !important;
        margin-bottom: 10px;
        font-size: 16px;
    }

    .quiz-content .explanation {
        min-height: auto !important;
        margin-top: 15px;
        font-size: 15px;
    }

    /* Адаптация шапки */
    header {
        flex-direction: row !important;
        padding: 1rem !important;
        gap: 10px;
        text-align: center;

    }

    header h1 {
        font-size: 1.0rem !important;
    }

    header a {
        padding: 0.8rem 1.2rem !important;
        font-size: 16px;
    }

    /* Адаптация навигации */
    .main-tabs {
        flex-wrap: wrap;
        padding: 0 0.5rem !important;
    }

    .main-tabs a {
        padding: 1rem 0.8rem !important;
        flex: 1;
        min-width: 33% !important;
        text-align: center;
        font-size: 14px;
    }

    .sub-tabs {
        flex-wrap: wrap;
        padding: 0 0.5rem !important;
    }

    .sub-tabs a {
        padding: 0.8rem 0.6rem !important;
        flex: 1;
        min-width: 15% !important;
        text-align: center;
        font-size: 13px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    /* Улучшение читаемости */
    body {
        font-size: 16px !important;
        line-height: 1.5;
    }

    .content-tile {
        padding: 15px !important;
        margin: 10px 0 !important;
    }

    .content-tile h3 {
        font-size: 1.2rem !important;
        margin-bottom: 12px;
    }

    /* Исправление пагинации */
    #page-info, #page-info-bottom {
        font-size: 16px !important;
        margin: 3px 0px;
        text-align: center;
        width: 190px;

    }
}

/* Дополнительные стили для очень маленьких экранов */
@media (max-width: 480px) {
    .container {
        padding: 8px !important;
    }

    .content-tile {
        padding: 12px !important;
    }

    .gallery-item img {
        height: 350px !important;
    }

    .main-tabs a {
        min-width: 33% !important;
        padding: 0.9rem 0.5rem !important;
        font-size: 13px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .sub-tabs a {
        min-width: 15% !important;
        /*padding: 0.7rem 0.4rem !important;*/
        padding: 0.5rem 3.8rem !important;
        font-size: 12px;
    }

    h2 {
        font-size: 1.3rem !important;
        text-align: center;
        margin-bottom: 15px;
    }

    .content-tile h3 {
        font-size: 1.1rem !important;
    }

    .gallery-nav {
        width: 30px !important;
        height: 30px !important;
        font-size: 14px !important;
    }
}

/* Удаляем конфликтующие стили */
/* Уберите эти строки из вашего CSS: */
/*
.tiles-container{
    display: block !important;
}
*/

/* Добавляем плавные переходы */
@media (max-width: 768px) {

    .content-tile {
        transition: all 0.3s ease;
    }

    .content-tile:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    button {
        transition: all 0.2s ease;
    }

    button:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
}