/* 모던 댓글 작성 폼 - Discord/Slack 스타일 */
.comment-form-modern {
    margin-bottom: 24px;
    position: relative;
}

.comment-input-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.comment-input-container:focus-within {
    border-color: #f64747;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px rgba(246, 71, 71, 0.1);
}

.input-inner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
}

/* 미니 아바타 */
.input-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    margin-top: 2px;
}

.input-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder-mini {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f64747 0%, #ff6b6b 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

/* 모던 입력창 */
.comment-input-modern {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff !important; /* 강제 흰색 글자 */
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    min-height: 36px;
    max-height: 150px;
    outline: none;
    padding: 6px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    /* 스크롤바 숨기기 - 모든 브라우저 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Chrome, Safari, Opera 스크롤바 숨기기 */
.comment-input-modern::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.comment-input-modern::placeholder {
    color: #6b7280 !important;
    font-size: 15px;
}

/* 액션 버튼 영역 */
.input-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding-left: 12px;
}

/* 입력창 내부 액션 버튼 */
.input-action-btn {
    background: none;
    border: none;
    color: #6b7280;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 18px;
}

.input-action-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f64747;
}

.input-action-btn:active {
    transform: scale(0.95);
}

/* 툴팁 */
.input-action-btn[title] {
    position: relative;
}

/* 글자수 카운터 */
.char-counter {
    font-size: 12px;
    color: #6b7280;
    padding: 0 8px;
    user-select: none;
    font-variant-numeric: tabular-nums;
}

.char-counter.warning {
    color: #fbbf24;
}

.char-counter.danger {
    color: #ef4444;
}

/* 모던 전송 버튼 */
.comment-submit-modern {
    background: #f64747;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 18px;
}

.comment-submit-modern:hover:not(:disabled) {
    background: #d63636;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(246, 71, 71, 0.3);
}

.comment-submit-modern:active:not(:disabled) {
    transform: translateY(0);
}

.comment-submit-modern:disabled {
    background: #374151;
    color: #6b7280;
    cursor: not-allowed;
    opacity: 0.6;
}

/* 답글 대상 표시 */
.reply-indicator {
    background: rgba(246, 71, 71, 0.1);
    border-top: 1px solid rgba(246, 71, 71, 0.2);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideDown 0.2s ease;
}

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

.reply-to-text {
    font-size: 13px;
    color: #9ca3af;
}

.reply-to-text strong {
    color: #f64747;
    font-weight: 600;
}

.cancel-reply {
    background: none;
    border: none;
    color: #6b7280;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 14px;
}

.cancel-reply:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* 댓글 이미지 미리보기 */
.comment-image-preview {
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.comment-image-preview .preview-images {
    display: flex;
    gap: 10px;
}

.comment-image-preview .comment-image-item {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

.comment-image-preview .comment-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comment-image-preview .remove-comment-image {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.comment-image-preview .remove-comment-image:hover {
    background: rgba(246, 71, 71, 0.9);
}

/* 업로드 중 표시 */
.uploading-comment-image {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9ca3af;
    font-size: 14px;
    padding: 20px;
}

.uploading-comment-image i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 댓글에 표시되는 이미지 */
.comment-images {
    margin-top: 10px;
}

.comment-images .comment-image-item {
    display: inline-block;
    max-width: 200px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.comment-images .comment-image-item:hover {
    transform: scale(1.02);
}

.comment-images .comment-image-item img {
    width: 100%;
    height: auto;
    display: block;
}

/* 반응형 - 모바일 */
@media (max-width: 768px) {
    .comment-form-modern {
        margin-bottom: 16px;
    }
    
    /* 모바일에서 2줄 레이아웃 */
    .input-inner {
        padding: 10px;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .input-avatar {
        width: 32px;
        height: 32px;
    }
    
    /* 첫째줄: 아바타 + 텍스트 입력창 */
    .comment-input-modern {
        font-size: 15px;
        min-height: 36px;
        flex: 1;
        width: calc(100% - 44px); /* 아바타 크기 + gap 제외 */
    }
    
    /* 둘째줄: 액션 버튼들 */
    .input-actions {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0 0 0;
        margin-left: 0;
        margin-top: 4px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    /* 버튼 그룹 정렬 */
    .input-actions {
        display: grid;
        grid-template-columns: auto auto 1fr auto;
        gap: 8px;
        align-items: center;
    }
    
    .input-action-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    /* 오른쪽 그룹: 글자수 + 전송 버튼 */
    .char-counter {
        font-size: 12px;
        padding: 0 8px;
        margin-left: auto; /* 오른쪽 정렬 */
        align-self: center;
    }
    
    .comment-submit-modern {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}

/* 작은 모바일 (375px 이하) */
@media (max-width: 375px) {
    .input-inner {
        padding: 8px;
    }
    
    .input-avatar {
        width: 28px;
        height: 28px;
    }
    
    .comment-input-modern {
        font-size: 14px;
        width: calc(100% - 40px);
    }
    
    .input-action-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .comment-submit-modern {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }
    
    .char-counter {
        font-size: 11px;
        padding: 0 6px;
    }
}

/* 다크모드 강제 (놀쟈는 다크모드 사이트) */
/* prefers-color-scheme 무시하고 항상 다크 스타일 유지 */
@media (prefers-color-scheme: light) {
    .comment-input-container {
        background: rgba(255, 255, 255, 0.05) !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
    }

    .comment-input-container:focus-within {
        background: rgba(255, 255, 255, 0.08) !important;
    }

    .comment-input-modern {
        color: #ffffff !important; /* 항상 흰색 글자 */
    }

    .input-action-btn {
        color: #9ca3af !important;
    }
}

/* 애니메이션 */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(246, 71, 71, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(246, 71, 71, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(246, 71, 71, 0);
    }
}

.comment-submit-modern.sending {
    animation: pulse 1s infinite;
}