/* Светлая тема для страницы персонажа */

/* Общие стили для body и базового оформления */
body {
    background-color: #f4f4f4;
    color: #333;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
}

/* Стили для переключателя темы */
.theme-switch-container {
    padding: 10px 20px;
    text-align: right;
    color: #bdbdbd;
    width: 100%; /* Занимает всю ширину на мобильных */
    margin-top: 80px;
}

.theme-switch-container label {
    margin-right: 8px;
}

#theme-switch {
    background: #242424;
    color: #f3f3f3;
    border: 1px solid #3a3a3a;
}

/* Заголовок */
.header {
    background-color: #007BFF;
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header a {
    color: white;
    text-decoration: none;
    font-weight: bold;
}

/* Контейнер страницы */
.container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 2px solid #007bff;
}

/* Аватар персонажа */
.avatar-container {
    text-align: center;
    margin-bottom: 20px;
}

.avatar-container img.profile-avatar {
    border-radius: 50%;
    width: 350px;
    height: 350px;
    object-fit: cover;
    border: 3px solid #007BFF;
}

/* Стили для информации о персонаже */
.info h1 {
    font-size: 2em;
    margin-bottom: 10px;
    color: #007BFF;
}

.info p {
    margin: 8px 0;
    line-height: 1.5;
    font-size: 1em;
}

/* Обрезка длинного текста с троеточием */
.truncated {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    /* Ограничение до 3 строк */
    line-clamp: 3;
    /* Стандартное свойство для совместимости */
    overflow: hidden;
    position: relative;
}

/* Когда раскрыто - отменяем ограничение */
.truncated.expanded {
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

/* Кнопка для переключения состояния */
.show-more-btn {
    display: inline-block;
    margin-top: 5px;
    font-size: 0.9em;
    color: #007BFF;
    cursor: pointer;
    text-decoration: underline;
    background: transparent;
    border: none;
    padding: 0;
}

/* Контейнер для кнопок действий */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    /* Расстояние между кнопками */
    margin-top: 30px;
    padding: 15px 0;
    border-top: 1px solid #eee;
}

/* Общие стили для кнопок */
.action-buttons .btn {
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 8px;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    cursor: pointer;
}

/* Стили для кнопки редактирования */
.edit-btn {
    background-color: #28c54a;
    color: white;
    border: none;
}

.edit-btn:hover {
    background-color: #218838;
}

/* Стили для кнопки "Начать чат" */
.start-chat-button {
    background-color: #007BFF;
    color: white;
    border: none;
}

.start-chat-button:hover {
    background-color: #0056b3;
}

/* Стили для слайд-шоу аватаров */
.avatar-slideshow {
    width: 100%;
    max-width: 500px;
    height: 500px;
    margin: 0 auto 20px;
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 3px solid #ffffff;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.slideshow-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 15px;
    box-sizing: border-box;
    background-color: transparent;
}

.slideshow-image.active {
    opacity: 1;
    z-index: 1;
}

.slideshow-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 12px;
    z-index: 2;
}

.slideshow-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid #ffffff;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.slideshow-dot:hover {
    transform: scale(1.3);
    background: rgba(0, 123, 255, 0.8);
}

.slideshow-dot.active {
    background: #007bff;
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.6);
}

/* Стили для галереи в стиле Instagram */
.gallery-section {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #e0e0e0;
}

.gallery-title {
    font-size: 28px;
    margin-bottom: 25px;
    color: #333;
    text-align: center;
    font-weight: 700;
    position: relative;
    padding-bottom: 10px;
}

.gallery-title:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, #007bff, #00bfff);
    border-radius: 3px;
}

.instagram-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 40px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
}

.gallery-item:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2);
    border-color: #007bff;
}

.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.3));
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1;
}

.gallery-item:hover::before {
    opacity: 1;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gif-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #ff0080, #ff8c00);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    z-index: 2;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 4px;
}

.gif-badge:before {
    content: '🎬';
    font-size: 10px;
}

/* Стили для модального окна (улучшенные) */
.gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
    overflow: hidden;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    position: relative;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 8px solid white;
    background: white;
    animation: zoomIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.close-modal {
    position: fixed;
    top: 25px;
    right: 30px;
    color: white;
    font-size: 44px;
    cursor: pointer;
    z-index: 10001;
    background: rgba(255, 255, 255, 0.1);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg) scale(1.1);
}

.prev-btn,
.next-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    z-index: 10001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.prev-btn:hover,
.next-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.prev-btn {
    left: 30px;
}

.next-btn {
    right: 30px;
}

/* Индикатор текущего изображения */
.image-counter {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 25px;
    border-radius: 25px;
    font-size: 16px;
    z-index: 10001;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.main-avatar-container {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.slideshow-timer {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    z-index: 2;
}

.timer-bar {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #00bfff);
    width: 0%;
    transition: width 0.1s linear;
    border-radius: 2px;
}

/* Стили для случая с одним аватаром */
.single-avatar-mode .slideshow-timer,
.single-avatar-mode .slideshow-controls {
    display: none;
}

/* Прячем таймер и точки если слайд только один */
.avatar-slideshow:has(.slideshow-image:only-child) .slideshow-timer,
.avatar-slideshow:has(.slideshow-image:only-child) .slideshow-controls {
    display: none;
}

/* Для единственного аватара - всегда показываем его */
.avatar-slideshow:has(.slideshow-image:only-child) .slideshow-image {
    position: relative;
    opacity: 1 !important;
}

/* Адаптивность */
@media (max-width: 768px) {
    .avatar-slideshow {
        max-width: 350px;
        height: 350px;
    }

    .instagram-gallery {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    .prev-btn,
    .next-btn {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .prev-btn {
        left: 15px;
    }

    .next-btn {
        right: 15px;
    }

    .close-modal {
        top: 15px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 36px;
    }

    .image-counter {
        font-size: 14px;
        padding: 8px 20px;
        bottom: 20px;
    }
}

@media (max-width: 480px) {
    .avatar-slideshow {
        max-width: 280px;
        height: 280px;
    }

    .instagram-gallery {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 10px;
    }

    .gallery-title {
        font-size: 22px;
    }
}

/* Тема для GIF изображений в слайд-шоу */
.slideshow-image.gif-playing {
    animation: subtlePulse 2s infinite;
}

@keyframes subtlePulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

/* Стили для секции лайков */
.like-section {
    margin: 20px 0;
    text-align: left;
}

.like-btn,
.dislike-btn {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border: 2px solid #dee2e6;
    border-radius: 14px;
    padding: 14px 22px;
    font-size: 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #495057;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.like-btn:hover,
.dislike-btn:hover {
    background: linear-gradient(145deg, #e9ecef, #dee2e6);
    border-color: #adb5bd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.like-btn.liked {
    background: linear-gradient(145deg, #ff6b6b, #ff5252);
    border-color: #ff3838;
    color: white;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.dislike-btn.disliked {
    background: linear-gradient(145deg, #6c757d, #495057);
    border-color: #343a40;
    color: white;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.35);
}

.like-btn.liked:hover {
    background: linear-gradient(145deg, #ff5252, #ff3838);
    border-color: #ff1744;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.dislike-btn.disliked:hover {
    background: linear-gradient(145deg, #495057, #343a40);
    border-color: #212529;
    box-shadow: 0 4px 12px rgba(52, 58, 64, 0.45);
}

.like-icon {
    font-size: 24px;
    transition: transform 0.2s ease;
}

.dislike-icon {
    font-size: 24px;
    transition: transform 0.2s ease;
}

.like-btn:hover .like-icon {
    transform: scale(1.1);
}

.dislike-btn:hover .dislike-icon {
    transform: scale(1.1);
}

.like-btn:active .like-icon {
    transform: scale(0.95);
}

.like-count {
    font-weight: 600;
    font-size: 16px;
    min-width: 24px;
    text-align: center;
}

.dislike-count {
    font-weight: 600;
    font-size: 16px;
    min-width: 24px;
    text-align: center;
}

/* Креативные стили для лайков в детальной информации персонажа */
.info h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.info .likes-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    font-size: 0.9em;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.info .likes-badge:hover {
    background: linear-gradient(145deg, #e9ecef, #dee2e6);
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.info .likes-badge.liked {
    background: linear-gradient(145deg, #ff6b6b, #ff5252);
    border-color: #ff3838;
    color: white;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.info .likes-badge.liked:hover {
    background: linear-gradient(145deg, #ff5252, #ff3838);
    border-color: #ff1744;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.info .like-heart-icon {
    font-size: 18px;
    transition: transform 0.2s ease;
    animation: heartbeat 1.5s ease-in-out infinite;
}

.info .likes-badge:hover .like-heart-icon {
    transform: scale(1.2);
}

.info .likes-badge.liked .like-heart-icon {
    animation: heartbeat 0.8s ease-in-out infinite;
    color: #ff1744;
}

.info .likes-count {
    font-weight: 600;
    font-size: 0.9em;
    min-width: 12px;
    text-align: center;
    color: inherit;
}

.info .gender-icon {
    transition: transform 0.2s ease;
}

.info .gender-icon:hover {
    transform: scale(1.1);
}

/* Стили для уведомлений */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 300px;
    word-wrap: break-word;
    animation: slideInRight 0.3s ease forwards;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.like-success {
    background: linear-gradient(145deg, #ff6b6b, #ff5252);
    border-left: 4px solid #ff3838;
}

.notification.like-removed {
    background: linear-gradient(145deg, #6c757d, #5a6268);
    border-left: 4px solid #495057;
}

.notification.dislike-success {
    background: linear-gradient(145deg, #6c757d, #495057);
    border-left: 4px solid #343a40;
}

.notification.dislike-removed {
    background: linear-gradient(145deg, #6c757d, #5a6268);
    border-left: 4px solid #495057;
}

.notification.favorite-success {
    background: linear-gradient(145deg, #ffc107, #ffb300);
    border-left: 4px solid #ff9800;
    color: #333;
}

.notification.favorite-removed {
    background: linear-gradient(145deg, #6c757d, #5a6268);
    border-left: 4px solid #495057;
}

.notification.error {
    background: linear-gradient(145deg, #dc3545, #c82333);
    border-left: 4px solid #bd2130;
}

.notification-icon {
    margin-right: 8px;
    font-size: 18px;
}

.notification-close {
    margin-left: 10px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.notification-close:hover {
    opacity: 1;
}

/* Анимация для уведомлений */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Адаптивность для уведомлений */
@media (max-width: 768px) {
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
        padding: 12px 15px;
        font-size: 0.9em;
    }
    
    .notification-icon {
        font-size: 16px;
        margin-right: 6px;
    }
    
    .notification-close {
        margin-left: 8px;
    }
}

/* Адаптивность для детальной страницы */
@media (max-width: 768px) {
    .info h1 {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .info .likes-badge {
        margin: 5px 0;
        font-size: 0.8em;
    }
    
    .info .like-heart-icon {
        font-size: 16px;
    }
    
    .info .gender-icon {
        width: 20px !important;
        height: 20px !important;
        margin-left: 0 !important;
    }
}