@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
    --brand-pink: #FF006F;
    --brand-pink-glow: rgba(255, 0, 111, 0.2);
}

.comment-main-container,
.comment-main-container * {
    box-sizing: border-box;
}

/* Comment Section UI */
.comment-main-container {
    font-family: 'Poppins', sans-serif !important;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    width: 100%;
    margin-top: 30px;
    margin-bottom: 30px;
    border: 1px solid #eee;
    overflow: hidden;
}

/* Scoped Layout & Helpers */
.comment-main-container .flex {
    display: flex;
}

.comment-main-container .items-center {
    align-items: center;
}

.comment-main-container .justify-between {
    justify-content: space-between;
}

.comment-main-container .justify-center {
    justify-content: center;
}

.comment-main-container .gap-3 {
    gap: 12px;
}

.comment-main-container .flex-1 {
    flex: 1;
}

.comment-main-container .relative {
    position: relative;
}

.comment-main-container .hidden {
    display: none;
}

/* Header */
.comment-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.comment-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0;
}

.comment-badge {
    font-size: 10px;
    font-weight: 700;
    color: white;
    background: var(--brand-pink);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Comment Area */
.comment-area {
    max-height: 800px;
    overflow-y: auto;
    background: #fafafa;
    padding: 20px;
}

/* Form Section */
.comment-footer {
    padding: 16px;
    background: #ffffff;
    border-top: 1px solid #f9fafb;
}

.reply-badge {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: #fff1f2;
    padding: 8px 16px;
    border-radius: 12px 12px 0 0;
    border: 1px solid #ffe4e6;
    border-bottom: none;
}

.reply-badge.active {
    display: flex;
}

.reply-badge-text {
    font-size: 10px;
    font-weight: 700;
    color: #e11d48;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.icon-btn:hover {
    color: var(--brand-pink);
}

.submit-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--brand-pink);
    color: white;
    box-shadow: 0 4px 12px var(--brand-pink-glow);
    border: none;
    cursor: pointer;
}

/* Emojis */
.emoji-grid {
    display: none;
    margin-top: 12px;
    padding: 8px;
    background: #f9fafb;
    border-radius: 12px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.emoji-grid.active {
    display: grid;
}

.emoji-item {
    font-size: 20px;
    cursor: pointer;
    text-align: center;
    padding: 4px;
    transition: transform 0.2s;
}

.emoji-item:hover {
    transform: scale(1.25);
}

/* Individual Comment Nodes */
.comment-node {
    animation: slideIn 0.3s ease-out;
    position: relative;
}

.comment-content {
    display: flex;
    gap: 12px;
}

.avatar-ring {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(to top right, #fbbf24, #c026d3);
    padding: 2px;
    flex-shrink: 0;
}

.avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: white;
    padding: 2px;
}

.avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #f3f4f6;
}

.user-name {
    font-size: 12px;
    font-weight: 700;
    color: #111827;
}

.comment-time {
    font-size: 10px;
    color: #9ca3af;
    margin-left: 8px;
}

.comment-text {
    font-size: 14px;
    color: #1f2937;
    line-height: 1.5;
    margin-top: 4px;
    word-break: break-word;
}

.comment-gif {
    margin-top: 8px;
    border-radius: 16px;
    width: 100%;
    max-width: 240px;
    border: 1px solid #f3f4f6;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.action-btn {
    font-size: 11px;
    color: #888;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.action-btn:hover,
.action-btn.liked {
    color: var(--brand-pink);
}

.del-btn {
    color: #fca5a5;
    margin-left: auto;
}

/* Replies */
.reply-line {
    position: absolute;
    left: 20px;
    top: 45px;
    bottom: 0;
    width: 2px;
    background: #f1f1f1;
}

.replies-container {
    margin-top: 16px;
    margin-left: 40px;
}

.toggle-replies-btn {
    color: var(--brand-pink);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.toggle-replies-btn i {
    transition: transform 0.2s;
}

.toggle-replies-btn.collapsed i {
    transform: rotate(-90deg);
}

/* GIF Sheet Scoped Styling */
.gif-panel-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.gif-sheet {
    background: white;
    width: 100%;
    max-width: 500px;
    height: 70vh;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.gif-sheet.active {
    transform: translateY(0);
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 10px auto;
}

.gif-search-bar {
    padding: 8px 20px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 12px;
}

.gif-search-bar input {
    flex: 1;
    padding: 8px 0;
    font-size: 14px;
    border: none;
    outline: none;
    font-weight: 500;
}

.gif-search-bar i {
    color: #9ca3af;
}

.gif-close {
    font-size: 12px;
    font-weight: 700;
    color: #9ca3af;
    border: none;
    background: none;
    cursor: pointer;
}

.gif-grid {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* Custom Textarea */
.custom-textarea {
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 20px;
    padding: 12px 20px;
    transition: all 0.2s;
    font-size: 14px;
    width: 100%;
    outline: none;
    resize: none;
    max-height: 128px;
    overflow-y: scroll;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.custom-textarea::-webkit-scrollbar {
    display: none;
}

.custom-textarea:focus {
    background: white;
    border-color: var(--brand-pink);
    box-shadow: 0 0 0 3px var(--brand-pink-glow);
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bigHeartFade {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

.big-heart-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 80px;
    color: white;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 10;
    animation: bigHeartFade 0.8s ease-out forwards;
}

.custom-scroll::-webkit-scrollbar {
    display: none;
}

.custom-scroll {
    -ms-overflow-style: none;
    scrollbar-width: none;
}