/**
 * Comment System Styles
 *
 * Dedicated stylesheet for the Route1Views comment system
 * Includes layout, animations, and interaction states
 */

/* Base Comment Layout */
.comment {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    position: relative;
}

/* Avatar Styles */
.comment-avatar-container {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.avatar-edit-btn {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: #00754a;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.avatar-edit-btn:hover {
    background: #005a3a;
    color: white;
    text-decoration: none;
    transform: scale(1.1);
}

/* Comment Content */
.comment-content {
    flex: 1;
    position: relative;
}

.comment-bubble {
    background-color: #f0f2f5;
    border-radius: 20px;
    padding: 12px 16px;
    margin-bottom: 8px;
    position: relative;
    min-height: 40px;
}

.comment-author {
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}

.comment-text {
    color: #555;
    line-height: 1.4;
}

/* Comment Images */
.comment-image-connection {
    position: relative;
    margin-top: 12px;
    padding-left: 20px;
}

.comment-image-connection::before {
    content: "";
    position: absolute;
    left: 8px;
    top: -12px;
    width: 2px;
    height: 30px;
    background: #e9ecef;
    border-radius: 1px;
}

.comment-image-connection::after {
    content: "";
    position: absolute;
    left: 8px;
    top: 18px;
    width: 20px;
    height: 2px;
    background: #e9ecef;
    border-radius: 1px;
}

.comment-image {
    margin-top: 0;
}

.comment-image img {
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
}

/* Like Counter */
.comment-like-counter {
    position: absolute;
    top: -8px;
    right: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    background: white;
    padding: 4px 8px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 11px;
    z-index: 10;
}

.comment-like-counter .like-count {
    font-weight: 600;
    color: #333;
}

.comment-like-counter i {
    color: #00754a;
    font-size: 14px;
}

.comment-like-counter.liked i {
    color: #00754a;
}

/* Like Counter Animations */
@keyframes like-drop-in {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.3) rotate(-10deg);
    }
    50% {
        opacity: 1;
        transform: translateY(3px) scale(1.5) rotate(8deg);
    }
    70% {
        transform: translateY(-2px) scale(0.9) rotate(-5deg);
    }
    85% {
        transform: translateY(1px) scale(1.05) rotate(3deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
}

@keyframes like-pulse-wiggle {
    0% {
        transform: scale(1) rotate(0deg);
    }
    10% {
        transform: scale(1.6) rotate(-5deg);
    }
    20% {
        transform: scale(1.8) rotate(5deg);
    }
    30% {
        transform: scale(1.7) rotate(-5deg);
    }
    40% {
        transform: scale(1.8) rotate(4deg);
    }
    50% {
        transform: scale(1.7) rotate(-4deg);
    }
    60% {
        transform: scale(1.4) rotate(2deg);
    }
    75% {
        transform: scale(1.1) rotate(-2deg);
    }
    90% {
        transform: scale(0.95) rotate(0deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

.comment-like-counter.animate-drop-in {
    animation: like-drop-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.comment-like-counter.animate-pulse-wiggle {
    animation: like-pulse-wiggle 0.7s ease-in-out;
}

/* Comment Actions */
.comment-actions {
    position: absolute;
    bottom: -10px;
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 4px 8px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 12px;
    z-index: 10;
}

.comment-timestamp {
    color: #6c757d;
    font-size: 11px;
    margin-right: 4px;
}

.comment-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    transition: all 0.2s ease;
}

.comment-actions button:hover {
    background: #f8f9fa;
    color: #495057;
}

.comment-like-btn {
    display: flex;
    align-items: center;
    gap: 4px;
}

.comment-like-btn.liked {
    color: #00754a;
}

.comment-like-btn.liked i {
    color: #00754a;
}

/* Threaded Comments - Unlimited Nesting Support */
.comment-children {
    margin-left: 3rem;
    padding-left: 1rem;
    border-left: 2px solid #e9ecef;
}

.comment-children .comment-bubble {
    background-color: #f8f9fa;
    border-radius: 16px;
}

/* Deeper Nesting Levels */
.comment-children .comment-children {
    margin-left: 2rem;
    border-left-color: #dee2e6;
}

.comment-children .comment-children .comment-bubble {
    background-color: #f1f3f4;
    border-radius: 14px;
}

.comment-children .comment-children .comment-children {
    margin-left: 1.5rem;
    border-left-color: #ced4da;
}

.comment-children .comment-children .comment-children .comment-bubble {
    background-color: #e9ecef;
    border-radius: 12px;
}

/* Level 3+ Comments (no reply button) */
.comment-children .comment-children .comment-children {
    opacity: 0.9;
}

.comment-children .comment-children .comment-children .comment-actions {
    border-top: 1px solid #dee2e6;
    padding-top: 8px;
    margin-top: 8px;
}

/* Reply Form */
.reply-form-container {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Timestamp display control - hide short by default */
.comment-timestamp-short {
    display: none;
}

.comment-timestamp-long {
    display: inline;
}

/* Mobile Styles */
@media (max-width: 767px) {
    /* Smaller author name and badge */
    .comment-author {
        font-size: 14px;
        margin-bottom: 2px;
    }

    .comment-author .badge {
        font-size: 9px;
        padding: 2px 6px;
    }

    /* Less padding between author and content */
    .comment-bubble {
        padding: 10px 14px;
    }

    /* Move action bar down more */
    .comment-actions {
        bottom: -14px;
    }

    /* Show short timestamp, hide long timestamp */
    .comment-timestamp-short {
        display: inline;
    }

    .comment-timestamp-long {
        display: none;
    }

    /* Hide button text on mobile for Add Photo and Cancel buttons only */
    .comment-form-container .form-actions-left .btn-text,
    .comment-form-container .cancel-reply-btn .btn-text {
        display: none;
    }

    .comment-form-container .form-actions-left .btn .fas,
    .comment-form-container .cancel-reply-btn .fas {
        margin: 0 !important;
    }

    /* Keep submit button text visible on mobile */
    .comment-form-container .submit-comment-btn .btn-text {
        display: inline;
    }

    /* Make buttons more compact */
    .comment-form-container .btn-sm {
        padding: 0.25rem 0.5rem;
    }
}
