.comments-section {
    margin-top: 1.25rem;
    border-top: 1px solid #ffffff;
    padding-top: 1rem;
}
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: none;
    overflow: visible;
    padding-right: 0;
}
.comment-item {
    background: #ffffff;
    border: 1px solid #eef6fb;
    padding: 0.75rem;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(24,39,56,0.03);
}
.comment-meta {
    display:flex;
    gap:0.5rem;
    align-items:center;
    margin-bottom:0.5rem;
}
.comment-username {
    font-weight:600;
    color:#0f1724;
}
.comment-time {
    font-size:0.85rem;
    color:#7b8a97;
}
.comment-content {
    white-space:pre-wrap;
    color:#122432;
}
.comment-form {
    display:flex;
    gap:0.5rem;
    margin-top:0.75rem;
}
.comment-form textarea {
    flex:1;
    min-height:48px;
    padding:0.5rem;
    border-radius:8px;
    border:1px solid #dbe8f2;
    resize:vertical;
}
.comment-form button {
    background: linear-gradient(180deg, var(--accent) 0%, #ff9a3b 100%);
    color: #ffffff;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(255,122,0,0.12);
    transition: transform .12s ease, box-shadow .12s ease;
}
.comment-form button:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(255,122,0,0.20); }
.comment-form button:active { transform: translateY(0); }
.comment-form button:focus { outline: 3px solid rgba(255,122,0,0.12); outline-offset: 2px; }
.comment-empty {
    color:#7b8a97;
    text-align:center;
    padding:0.5rem 0;
}

/* Login prompt shown when user is not authenticated */
.comment-login-prompt {
    margin-top: 0.5rem;
}
.comment-login-prompt > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border-radius: 12px;
    background: linear-gradient(180deg, #0f1724 0%, #0b1220 100%); /* darker background */
    border: 1px solid rgba(255,255,255,0.04);
    box-shadow: 0 8px 24px rgba(2,6,23,0.6);
    color: #e6eef8;
}
.comment-login-prompt .comment-login-btn {
    background: linear-gradient(180deg, var(--accent) 0%, #ff9a3b 100%);
    color: #ffffff;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
    box-shadow: 0 8px 18px rgba(255,122,0,0.12);
}
.comment-login-prompt .comment-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(255,122,0,0.20);
}
.comment-login-prompt .comment-login-btn:active { transform: translateY(0); }
.comment-login-prompt .comment-login-btn:focus { outline: 3px solid rgba(255,122,0,0.12); outline-offset: 2px; }

/* ensure textarea and button align when prompt is shown */
.comment-form.hidden { display: none; }

/* Inline per-comment action buttons (edit/delete) */
.comment-actions-inline {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin-left: 0.5rem;
}
.comment-action-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(16,24,32,0.06);
    background: transparent;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.comment-action-btn i { font-size: 14px; line-height:1; }

/* Edit button (blue, subtle) */
.comment-action-btn.edit {
    background: linear-gradient(180deg, #e7f5ff 0%, #dff0ff 100%);
    color: #075985;
    border-color: rgba(3,105,161,0.08);
    box-shadow: 0 6px 12px rgba(3,105,161,0.04) inset;
}
.comment-action-btn.edit:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(3,105,161,0.08); }

/* Delete button (red, subtle) */
.comment-action-btn.delete {
    background: linear-gradient(180deg, #fff4f4 0%, #ffe6e6 100%);
    color: #8b1d1d;
    border-color: rgba(255,77,77,0.08);
    box-shadow: 0 6px 12px rgba(255,77,77,0.04) inset;
}
.comment-action-btn.delete:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(255,77,77,0.08); }

/* neutral small hover fallback for other states */
.comment-action-btn:hover:not(.edit):not(.delete) { background: rgba(0,0,0,0.04); }

.comment-avatar.small { width: 36px; height: 36px; flex: 0 0 36px; }

.comment-edit-area textarea {
    width: 100%;
    min-height: 72px;
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid #dbe8f2;
    background: #ffffff;
    color: #122432;
}
.comment-edit-controls {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}
.comment-edit-controls .btn { padding: 0.4rem 0.6rem; border-radius: 8px; }
.comment-edit-controls .btn-secondary { background: transparent; border: 1px solid #dbe8f2; color: #122432; }

/* Make save button in comment edit controls orange */
.comment-edit-controls .save,
.comment-edit-controls .btn-primary,
.comment-edit-controls button.save-edit {
    background: linear-gradient(90deg,#ff9a3b,#ff7a00) !important;
    color: #fff !important;
    border: none !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 18px rgba(255,122,0,0.12) !important;
    font-weight: 700 !important;
    transition: transform 180ms cubic-bezier(.2,.9,.2,1), box-shadow 180ms ease, background 180ms ease;
}
.comment-edit-controls .save:hover,
.comment-edit-controls .btn-primary:hover,
.comment-edit-controls button.save-edit:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(255,122,0,0.16) !important;
}

/* Delete confirmation modal */
.comment-delete-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2,6,23,0.0);
    z-index: 10001; /* above recipe modal (z-index:10000) */
    opacity: 0;
    visibility: hidden;
    transition: background 220ms ease, opacity 220ms ease, visibility 220ms ease;
}
.comment-delete-modal-overlay.open {
    background: rgba(2,6,23,0.5);
    opacity: 1;
    visibility: visible;
}
.comment-delete-modal {
    background: #ffffff;
    color: #0f1724;
    padding: 20px;
    border-radius: 12px;
    max-width: 420px;
    width: 92%;
    box-shadow: 0 20px 40px rgba(2,6,23,0.28);
    transform: translateY(12px) scale(0.98);
    opacity: 0;
    transition: transform 260ms cubic-bezier(.2,.9,.2,1), opacity 260ms ease;
}
.comment-delete-modal.open { transform: translateY(0) scale(1); opacity: 1; }
.comment-delete-modal .title { font-weight: 700; font-size: 1.05rem; margin-bottom: 6px; }
.comment-delete-modal .desc { color: #51606a; margin-bottom: 14px; line-height:1.4; }
.comment-delete-modal .actions { display: flex; gap: 10px; justify-content: flex-end; }
.comment-delete-modal .btn { padding: 0.55rem 0.9rem; border-radius: 8px; border: none; cursor: pointer; font-weight: 600; }
.comment-delete-modal .btn.cancel { background: transparent; border: 1px solid #e6eef8; color: #122432; }
.comment-delete-modal .btn.confirm { background: linear-gradient(180deg, var(--accent) 0%, #ff9a3b 100%); color: #ffffff; box-shadow: 0 8px 18px rgba(255,122,0,0.12); }
.comment-delete-modal .btn:focus { outline: 3px solid rgba(255,122,0,0.12); outline-offset: 2px; }

/* Highlighted comment state when opened from My Comments */
.comment-item.comment-highlight {
    background: linear-gradient(90deg, #ccffd7 0%, #e6fff0 100%);
    border-color: rgba(46,204,113,0.18);
    box-shadow: 0 12px 30px rgba(46,204,113,0.14);
    transform: translateY(-2px);
    transition: background 300ms ease, box-shadow 300ms ease, transform 200ms ease;
}

.comment-item.comment-highlight .comment-content { background: transparent; }

/* ========== МОБІЛЬНА АДАПТАЦІЯ comments (max-width: 768px) ========== */
@media (max-width: 768px) {
    .comments-section {
        margin-top: 1rem !important;
        padding-top: 1rem !important;
        border-top: 1px solid rgba(255,255,255,0.1) !important;
    }
    
    .comments-list {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        max-height: none !important;
        overflow: visible !important;
        padding-right: 0 !important;
    }
    
    .comment-item {
        background: #ffffff !important;
        border: 1px solid #eef6fb !important;
        padding: 1rem !important;
        border-radius: 8px !important;
        box-shadow: 0 1px 2px rgba(24,39,56,0.03) !important;
    }
    
    .comment-meta {
        display: flex !important;
        gap: 0.75rem !important;
        margin-bottom: 0.75rem !important;
        flex-wrap: wrap !important;
        align-items: center !important;
    }
    
    .comment-username {
        font-size: 0.95rem !important;
        font-weight: 600 !important;
        color: #0f1724 !important;
    }
    
    .comment-time {
        font-size: 0.85rem !important;
        color: #7b8a97 !important;
    }
    
    .comment-content {
        font-size: 0.95rem !important;
        line-height: 1.5 !important;
        word-wrap: break-word !important;
        white-space: pre-wrap !important;
        color: #122432 !important;
    }
    
    .comment-form {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        margin-top: 1rem !important;
    }
    
    .comment-form[style*="display: none"],
    .comment-form.hidden {
        display: none !important;
    }
    
    .comment-form textarea {
        width: 100% !important;
        min-height: 80px !important;
        padding: 0.75rem !important;
        font-size: 0.95rem !important;
        border-radius: 8px !important;
        border: 1px solid #dbe8f2 !important;
        background: #ffffff !important;
        color: #122432 !important;
        font-family: inherit !important;
        resize: vertical !important;
    }
    
    .comment-form textarea::placeholder {
        color: #a0adb8 !important;
    }
    
    .comment-form textarea:focus {
        outline: 2px solid var(--accent) !important;
        outline-offset: -1px !important;
        border-color: var(--accent) !important;
    }
    
    .comment-form button {
        width: 100% !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.95rem !important;
        height: auto !important;
        min-height: 44px !important;
        background: linear-gradient(180deg, var(--accent) 0%, #ff9a3b 100%) !important;
        color: #ffffff !important;
        border: none !important;
        border-radius: 10px !important;
        cursor: pointer !important;
        font-weight: 700 !important;
        box-shadow: 0 8px 18px rgba(255,122,0,0.12) !important;
        transition: transform 120ms ease, box-shadow 120ms ease !important;
    }
    
    .comment-form button:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 12px 28px rgba(255,122,0,0.18) !important;
    }
    
    .comment-form button:active {
        transform: translateY(0) !important;
    }
    
    .comment-form button:focus {
        outline: 3px solid rgba(255,122,0,0.12) !important;
        outline-offset: 2px !important;
    }
    
    .comment-actions-inline {
        display: inline-flex !important;
        gap: 6px !important;
        align-items: center !important;
        margin-top: 0.75rem !important;
        margin-left: 0 !important;
    }
    
    .comment-action-btn {
        width: 36px !important;
        height: 36px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 8px !important;
        border: 1px solid rgba(16,24,32,0.06) !important;
        background: transparent !important;
        cursor: pointer !important;
        transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease !important;
    }
    
    .comment-action-btn i {
        font-size: 14px !important;
        line-height: 1 !important;
    }
    
    .comment-action-btn.edit {
        background: linear-gradient(180deg, #e7f5ff 0%, #dff0ff 100%) !important;
        color: #075985 !important;
        border-color: rgba(3,105,161,0.08) !important;
        box-shadow: 0 6px 12px rgba(3,105,161,0.04) inset !important;
    }
    
    .comment-action-btn.edit:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 10px 20px rgba(3,105,161,0.08) !important;
    }
    
    .comment-action-btn.delete {
        background: linear-gradient(180deg, #fff4f4 0%, #ffe6e6 100%) !important;
        color: #8b1d1d !important;
        border-color: rgba(255,77,77,0.08) !important;
        box-shadow: 0 6px 12px rgba(255,77,77,0.04) inset !important;
    }
    
    .comment-action-btn.delete:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 10px 20px rgba(255,77,77,0.08) !important;
    }
    
    .comment-empty {
        color: #7b8a97 !important;
        text-align: center !important;
        padding: 1rem !important;
        font-size: 0.95rem !important;
    }
    
    .comment-edit-area textarea {
        width: 100% !important;
        min-height: 80px !important;
        padding: 0.75rem !important;
        border-radius: 8px !important;
        border: 1px solid #dbe8f2 !important;
        background: #ffffff !important;
        color: #122432 !important;
    }
    
    .comment-edit-controls {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        margin-top: 0.75rem !important;
    }
    
    .comment-edit-controls .btn {
        padding: 0.75rem !important;
        border-radius: 8px !important;
        width: 100% !important;
        min-height: 44px !important;
    }
    
    .comment-edit-controls .btn-secondary {
        background: transparent !important;
        border: 1px solid #dbe8f2 !important;
        color: #122432 !important;
    }
    
    .comment-edit-controls .save,
    .comment-edit-controls .btn-primary,
    .comment-edit-controls button.save-edit {
        background: linear-gradient(90deg,#ff9a3b,#ff7a00) !important;
        color: #fff !important;
        border: none !important;
        padding: 0.75rem 1rem !important;
        border-radius: 8px !important;
        box-shadow: 0 8px 18px rgba(255,122,0,0.12) !important;
        font-weight: 700 !important;
        transition: transform 180ms cubic-bezier(.2,.9,.2,1), box-shadow 180ms ease, background 180ms ease !important;
        width: 100% !important;
        min-height: 44px !important;
    }
    
    .comment-edit-controls .save:hover,
    .comment-edit-controls .btn-primary:hover,
    .comment-edit-controls button.save-edit:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 12px 30px rgba(255,122,0,0.16) !important;
    }
    
    .comment-delete-modal {
        width: 90% !important;
        padding: 1.25rem !important;
        border-radius: 12px !important;
    }
    
    .comment-delete-modal .title {
        font-size: 1rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .comment-delete-modal .actions {
        display: flex !important;
        flex-direction: column-reverse !important;
        gap: 0.75rem !important;
    }
    
    .comment-delete-modal .btn {
        width: 100% !important;
        padding: 0.75rem !important;
        min-height: 44px !important;
    }
    
    .comment-login-prompt > div {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        padding: 1rem !important;
    }
    
    .comment-login-prompt .comment-login-btn {
        width: 100% !important;
        padding: 0.75rem !important;
        min-height: 44px !important;
    }
}
    
    .comment-delete-modal .desc {
        font-size: 0.9rem !important;
        margin-bottom: 1rem !important;
    }
    
    .comment-delete-modal .btn {
        flex: 1 !important;
        font-size: 0.9rem !important;
        padding: 0.65rem !important;
        min-height: 40px !important;
    }
}

