/* ===== МОДАЛЬНОЕ ОКНО ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 24px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transition: background-color 0.2s, color 0.2s;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #000;
}

.modal-content h2 {
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 600;
}

/* ===== ФОРМА ===== */
.form-row {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 15px;
}

.avatar-upload {
    position: relative;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.avatar-label {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #E60023;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.avatar-label:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.camera-icon {
    width: 28px;
    height: 28px;
    filter: brightness(0) invert(1);
}

.avatar-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #E60023;
}

.flex-grow {
    flex: 1;
}

.form-group.flex-grow {
    margin: 0;
}

.form-group {
    margin-bottom: 15px;
    width: 100%;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 16px;
    font-family: "Noto Sans Display", sans-serif;
    outline: none;
    transition: border-color 0.3s ease, background 0.2s, color 0.2s;
    box-sizing: border-box;
    background: transparent;
    color: #000;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    border-color: #E60023;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

#commentForm button[type="submit"] {
    width: 100%;
    padding: 14px;
    background: #E60023;
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s ease;
    font-family: "Noto Sans Display", sans-serif;
}

#commentForm button[type="submit"]:hover {
    background: #ff3b3b;
    transform: scale(1.02);
}

#commentForm button[type="submit"]:active {
    transform: scale(0.98);
}

#commentForm button[type="submit"]:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ===== СООБЩЕНИЯ ФОРМЫ ===== */
#formMessage {
    margin-top: 15px;
}

#formMessage p {
    padding: 12px;
    border-radius: 8px;
    margin: 0;
}

#formMessage .success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#formMessage .error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== СЕКЦИЯ КОММЕНТАРИЕВ (десктоп) ===== */
.comments-section {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 54px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.comments-section.expanded {
    max-height: 280px;
}

/* Иконка раскрытия */
.comments img {
    transition: transform 0.3s ease;
}

.comments img.expanded {
    transform: rotate(180deg);
}

/* ===== СПИСОК КОММЕНТАРИЕВ ===== */
#commentsList {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-right: 5px;
    margin-top: 12px;
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

#commentsList.expanded {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

#commentsList::-webkit-scrollbar {
    width: 6px;
}

#commentsList::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#commentsList::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

#commentsList::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===== ЭЛЕМЕНТ КОММЕНТАРИЯ ===== */
.comment-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
    font-size: 16px;
    background: none;
    border: none;
}

.comment-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.comment-avatar-placeholder {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.comment-content {
    display: flex;
    flex-direction: column;
    line-height: 1.4;
    min-width: 0;
}

.comment-nickname {
    font-weight: 600;
    color: #000;
}

.comment-text {
    color: #333;
    word-wrap: break-word;
}

/* ===== ТЁМНАЯ ТЕМА ===== */
body.theme .modal-content {
    background-color: #1e1e1e;
    color: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

body.theme .modal-content h2 {
    color: white;
}

body.theme .modal-close {
    color: rgba(255, 255, 255, 0.4);
}

body.theme .modal-close:hover {
    color: white;
}

body.theme .form-group input[type="text"],
body.theme .form-group textarea {
    background: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
}

body.theme .form-group input[type="text"]::placeholder,
body.theme .form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

body.theme .form-group input[type="text"]:focus,
body.theme .form-group textarea:focus {
    border-color: #E60023;
}

body.theme .comment-nickname {
    color: #fff;
}

body.theme .comment-text {
    color: rgba(255, 255, 255, 0.7);
}

body.theme #commentsList::-webkit-scrollbar-track {
    background: #2a2a2a;
}

body.theme #commentsList::-webkit-scrollbar-thumb {
    background: #555;
}

body.theme #commentsList::-webkit-scrollbar-thumb:hover {
    background: #777;
}

body.theme #commentsList {
    scrollbar-color: #555 #2a2a2a;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media screen and (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .modal-content h2 {
        font-size: 20px;
    }

    .comment-item {
        font-size: 14px;
        padding: 10px 0;
    }

    .comment-avatar,
    .comment-avatar-placeholder {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}