/* ═══════════════════════════════════════════════════
   COMMENTS SECTION — REDISEÑO PREMIUM
   Inspirado en Store y Premium (index.html)
   Compartido entre viewer.html e index.html
   ═══════════════════════════════════════════════════ */

/* ── Layout Base ── */
.comments-section {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    font-size: 1rem;
}

.comments-viewer-card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    position: relative;
}

/* ── Header ── */
.comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    background: var(--bg-panel);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    transition: border-color 0.25s;
}

.comments-header:hover {
    border-color: rgba(245,165,36,0.15);
}

.comments-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.comments-header-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245,165,36,0.1);
    border-radius: 12px;
    color: var(--primary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.comments-header-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.3px;
}

.comments-header-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(245,165,36,0.15);
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    margin-left: 0.5rem;
    letter-spacing: 0.5px;
    min-width: 1.5rem;
}

.comments-header-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comments-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: rgba(245,165,36,0.15);
    border: 2px solid rgba(245,165,36,0.2);
    flex-shrink: 0;
}

.comments-header-user span {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.6);
    font-weight: 600;
}

/* ── Comment Form Card ── */
.comment-form-card {
    background: var(--bg-panel);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.comment-form-card:focus-within {
}

.comment-form-inner {
    display: flex;
    gap: 1rem;
}

.comment-form-avatar {
    flex-shrink: 0;
}

.comment-form-avatar-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: rgba(245,165,36,0.15);
    flex-shrink: 0;
}

.comment-form-avatar-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 2px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.3);
    font-size: 1.2rem;
}

.comment-form-input-wrap {
    flex: 1;
    position: relative;
}

.comment-form-textarea {
    width: 100%;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    color: #fff;
    padding: 1rem;
    padding-top: 1.5rem;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    min-height: 90px;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    line-height: 1.5;
}

.comment-form-textarea:focus {
    outline: none;
    border-color: rgba(245,165,36,0.4);
    box-shadow: 0 0 0 3px rgba(245,165,36,0.08);
    background: rgba(0,0,0,0.5);
}

.comment-form-textarea::placeholder {
    color: rgba(255,255,255,0.25);
}

.comment-form-char-count {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    font-size: 0.6rem;
    font-weight: 700;
    color: rgba(245,165,36,0.5);
    background: rgba(0,0,0,0.5);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(245,165,36,0.1);
    letter-spacing: 0.5px;
}

.comment-form-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
    gap: 0.5rem;
}

.comment-form-cancel {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
    padding: 0.45rem 1.25rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.comment-form-cancel:hover {
    border-color: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.7);
}

.comment-form-submit {
    background: linear-gradient(135deg, #f5a524 0%, #e69500 100%);
    color: #000;
    border: none;
    padding: 0.45rem 1.5rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.82rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
    letter-spacing: 0.3px;
}

.comment-form-submit:hover {
    opacity: 0.92;
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(245,165,36,0.3);
}

.comment-form-submit:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Comment Banner Card ── */
.comment-banner-card {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 0.875rem;
    transition: transform 0.3s, box-shadow 0.3s;
    background: var(--banner-default);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.comment-banner-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.25);
}

.comment-banner-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.comment-banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(0,0,0,0.82) 0%,
        rgba(0,0,0,0.5) 40%,
        rgba(0,0,0,0.35) 100%
    );
}

.comment-banner-content {
    position: relative;
    z-index: 1;
    padding: 1rem 1.25rem;
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
}

/* ── Avatar ── */
.comment-avatar-wrap {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: rgba(245,165,36,0.15);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

/* ── Comment Body ── */
.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
    gap: 0.5rem;
}

.comment-author-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.comment-author {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.comment-badge-tu {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #f5a524 0%, #ff7e5f 100%);
    color: #000;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.comment-time {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.35);
    font-weight: 400;
    white-space: nowrap;
    flex-shrink: 0;
}

.comment-time-sep {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.comment-text {
    color: rgba(255,255,255,0.88);
    font-size: 0.88rem;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
    margin-bottom: 0.6rem;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-reply-action {
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-reply-action:hover {
    color: var(--primary);
    background: rgba(245,165,36,0.08);
}

/* ── Dropdown ── */
.comment-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.comment-dropdown-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.2);
    cursor: pointer;
    padding: 0.3rem 0.4rem;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.85rem;
    line-height: 1;
}

.comment-dropdown-btn:hover {
    color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.05);
}

.comment-dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 50;
    min-width: 130px;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 0.35rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: none;
}

.comment-dropdown-menu.open {
    display: block;
}

.comment-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.comment-dropdown-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.comment-dropdown-item.danger {
    color: #f87171;
}

.comment-dropdown-item.danger:hover {
    background: rgba(248,113,113,0.1);
}

/* ── Replies ── */
.comment-banner-card.is-reply {
    margin-left: 2.5rem;
    margin-bottom: 0.625rem;
    border-radius: 12px;
}

.comment-banner-card.is-reply .comment-banner-content {
    padding: 0.75rem 1rem;
}

.comment-banner-card.is-reply .comment-avatar-wrap {
    width: 34px;
    height: 34px;
}

.comment-banner-card.is-reply .comment-author {
    font-size: 0.82rem;
}

.comment-banner-card.is-reply .comment-text {
    font-size: 0.82rem;
}

.comment-banner-card.is-reply .comment-meta {
    margin-bottom: 0.2rem;
}

.comment-item-wrapper {
    position: relative;
}

/* ── Reply Form ── */
.reply-form-container {
    margin-bottom: 0.875rem;
}

/* ── Edit Form ── */
.comment-edit-wrap {
    padding: 0.75rem;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(245,165,36,0.15);
    border-radius: 12px;
    margin-bottom: 0.5rem;
}

.comment-edit-textarea {
    width: 100%;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(245,165,36,0.25);
    border-radius: 10px;
    color: #fff;
    padding: 0.85rem;
    padding-top: 1.4rem;
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.5;
}

.comment-edit-textarea:focus {
    outline: none;
    border-color: rgba(245,165,36,0.5);
    box-shadow: 0 0 0 3px rgba(245,165,36,0.1);
}

.comment-edit-char-count {
    position: absolute;
    top: 0.4rem;
    right: 0.65rem;
    font-size: 0.6rem;
    font-weight: 700;
    color: rgba(245,165,36,0.5);
    background: rgba(0,0,0,0.5);
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(245,165,36,0.1);
}

.comment-edit-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.65rem;
    gap: 0.5rem;
}

/* ── Loading State ── */
.comments-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem 0;
}

.comments-loading .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--primary);
}

/* ── Empty State ── */
.comments-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
    font-size: 0.9rem;
}

/* ── Error State ── */
.comments-error {
    text-align: center;
    padding: 2rem 1rem;
    color: #f87171;
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(248,113,113,0.05);
    border: 1px solid rgba(248,113,113,0.15);
    border-radius: 12px;
}

/* ═══════════════════════════════════════════════════
   MOBILE — 100% ANCHO, SIN MÁRGENES
   ═══════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .comments-section {
        margin-top: 16px;
        padding: 0;
        max-width: 100%;
    }

    .comments-viewer-card {
        margin: 0;
        border-radius: 0;
    }

    .comments-header {
        border-radius: 0;
        padding: 1rem 0.75rem;
        margin-bottom: 0;
        border-left: none;
        border-right: none;
    }

    .comments-header-icon {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }

    .comments-header-title {
        font-size: 1rem;
    }

    .comments-header-badge {
        font-size: 0.6rem;
    }

    .comments-header-user span {
        display: none;
    }

    .comments-header-avatar {
        width: 30px;
        height: 30px;
    }

    .comment-form-card {
        border-radius: 0;
        padding: 0.75rem;
        margin-bottom: 0;
        border-left: none;
        border-right: none;
    }

    .comment-form-inner {
        gap: 0.6rem;
    }

    .comment-form-avatar-circle,
    .comment-form-avatar-placeholder {
        width: 36px;
        height: 36px;
    }

    .comment-form-textarea {
        font-size: 0.85rem;
        padding: 0.75rem;
        padding-top: 1.3rem;
        min-height: 80px;
    }

    .comment-form-submit {
        font-size: 0.78rem;
        padding: 0.4rem 1.25rem;
    }

    .comment-banner-card {
        border-radius: 0;
        margin-bottom: 0;
        border-left: none;
        border-right: none;
    }

    .comment-banner-card:hover {
        transform: none;
    }

    .comment-banner-card.is-reply {
        margin-left: 0.75rem;
        border-radius: 0;
    }

    .comment-banner-content {
        padding: 0.75rem;
        gap: 0.625rem;
    }

    .comment-avatar-wrap {
        width: 36px;
        height: 36px;
    }

    .comment-banner-card.is-reply .comment-avatar-wrap {
        width: 28px;
        height: 28px;
    }

    .comment-author {
        font-size: 0.82rem;
        max-width: 120px;
    }

    .comment-time {
        font-size: 0.65rem;
    }

    .comment-text {
        font-size: 0.82rem;
    }

    .btn-reply-action {
        font-size: 0.72rem;
        padding: 0.2rem 0.4rem;
    }

    .comments-empty {
        padding: 2rem 1rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .comments-header {
        padding: 0.75rem 0.5rem;
    }

    .comment-banner-content {
        padding: 0.625rem;
    }

    .comment-author {
        max-width: 100px;
        font-size: 0.78rem;
    }

    .comment-text {
        font-size: 0.78rem;
    }

    .comment-banner-card.is-reply {
        margin-left: 0.5rem;
    }
}
