/* =================================================================
   Comment & Wishes for Elementor — Frontend Styles
   ================================================================= */

/* ── Elementor Wrapper Override ─────────────────────────────────── */
.elementor-widget-comment_wishes {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    align-self: stretch !important;
    flex-basis: 100% !important;
}

.elementor-widget-comment_wishes>.elementor-widget-container {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
}

/* ── Container ──────────────────────────────────────────────────── */
.cwe-container {
    font-family: inherit;
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
}

.cwe-container *,
.cwe-container *::before,
.cwe-container *::after {
    box-sizing: border-box;
}

/* Force all main sections to stretch */
.cwe-container .cwe-header,
.cwe-container .cwe-form,
.cwe-container .cwe-comment-counter,
.cwe-container .cwe-comments-list,
.cwe-container .cwe-empty-state {
    width: 100%;
}

/* ── Header ─────────────────────────────────────────────────────── */
.cwe-header {
    margin-bottom: 24px;
}

.cwe-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.cwe-subtitle {
    font-size: 14px;
    margin: 0;
    opacity: 0.7;
}

/* ── Form ───────────────────────────────────────────────────────── */
.cwe-form {
    margin-bottom: 24px;
}

.cwe-form-row {
    margin-bottom: 12px;
    position: relative;
}

.cwe-form-row:last-child {
    margin-bottom: 0;
}

.cwe-input,
.cwe-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e0e0e0;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    resize: none;
}

.cwe-input::placeholder,
.cwe-textarea::placeholder {
    color: #aaa;
}

.cwe-textarea {
    min-height: 80px;
}

.cwe-char-count {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 11px;
    color: #bbb;
    pointer-events: none;
    transition: color 0.2s;
}

.cwe-char-count.cwe-near-limit {
    color: #e67e22;
}

.cwe-char-count.cwe-at-limit {
    color: #e74c3c;
    font-weight: 600;
}

/* ── Submit Button ──────────────────────────────────────────────── */
.cwe-form-actions {
    display: flex;
    justify-content: flex-end;
}

.cwe-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.25s ease;
    line-height: 1;
}

.cwe-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cwe-submit-btn:active {
    transform: translateY(0);
}

.cwe-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cwe-btn-spinner {
    display: inline-flex;
    align-items: center;
}

.cwe-spinner-svg {
    animation: cwe-spin 1s linear infinite;
}

@keyframes cwe-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ── Toast ──────────────────────────────────────────────────────── */
.cwe-toast {
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 16px;
    animation: cwe-slideDown 0.35s ease;
    text-align: center;
}

.cwe-toast-success {
    background: #eafaf1;
    color: #27ae60;
    border: 1px solid #a3e4bc;
}

.cwe-toast-error {
    background: #fdecea;
    color: #e74c3c;
    border: 1px solid #f5c6cb;
}

@keyframes cwe-slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Comment Counter ────────────────────────────────────────────── */
.cwe-comment-counter {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    color: #888;
}

.cwe-counter-icon {
    font-size: 16px;
}

/* ── Comments List ──────────────────────────────────────────────── */
.cwe-comments-list {
    overflow-y: auto;
    position: relative;
    scroll-behavior: smooth;
}

/* Custom scrollbar */
.cwe-comments-list::-webkit-scrollbar {
    width: 5px;
}

.cwe-comments-list::-webkit-scrollbar-track {
    background: transparent;
}

.cwe-comments-list::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 10px;
}

.cwe-comments-list::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ── Comment Card ───────────────────────────────────────────────── */
.cwe-comment-card {
    animation: cwe-fadeIn 0.4s ease;
    min-width: 0;
    overflow: hidden;
}

.cwe-comment-card.cwe-new {
    animation: cwe-fadeInUp 0.5s ease;
}

.cwe-comment-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

/* ── Avatar ─────────────────────────────────────────────────────── */
.cwe-avatar {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 16px;
    text-transform: uppercase;
}

/* ── Comment Meta ───────────────────────────────────────────────── */
.cwe-comment-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cwe-comment-name {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
}

.cwe-comment-time {
    font-size: 11px;
    line-height: 1.3;
}

/* ── Comment Message ────────────────────────────────────────────── */
.cwe-comment-message {
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
    min-width: 0;
    max-width: 100%;
}

/* ── Emoji Reactions ────────────────────────────────────────────── */
.cwe-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.cwe-reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: none;
    border-radius: 20px;
    padding: 4px 10px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    line-height: 1;
}

.cwe-reaction-btn:hover {
    transform: scale(1.1);
}

.cwe-reaction-btn:active {
    transform: scale(0.95);
}

.cwe-reaction-btn .cwe-reaction-count {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    min-width: 8px;
    text-align: center;
}

.cwe-reaction-btn.cwe-reacted {
    box-shadow: 0 0 0 2px rgba(212, 165, 116, 0.4);
}

/* ── Loading ────────────────────────────────────────────────────── */
.cwe-loading {
    display: flex;
    justify-content: center;
    padding: 24px 0;
}

.cwe-loading-dots {
    display: flex;
    gap: 6px;
}

.cwe-loading-dots span {
    width: 8px;
    height: 8px;
    background: #ccc;
    border-radius: 50%;
    animation: cwe-bounce 1.4s infinite ease-in-out both;
}

.cwe-loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.cwe-loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.cwe-loading-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes cwe-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* ── Empty State ────────────────────────────────────────────────── */
.cwe-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #aaa;
}

.cwe-empty-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 10px;
}

.cwe-empty-state p {
    margin: 0;
    font-size: 14px;
}

/* ── Animations ─────────────────────────────────────────────────── */
@keyframes cwe-fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes cwe-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .cwe-title {
        font-size: 20px;
    }

    .cwe-comment-top {
        gap: 10px;
    }

    .cwe-reactions {
        gap: 4px;
    }

    .cwe-reaction-btn {
        padding: 3px 8px;
    }
}