/**
 * Replies UI Styles
 *
 * @package IndiePortal
 * @since 1.0.0
 */

/* ==========================================================================
   Section Container
   ========================================================================== */

.ip-replies-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ip-replies-header {
    margin-bottom: 20px;
}

.ip-replies-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

/* ==========================================================================
   Reply Form
   ========================================================================== */

.ip-reply-form-wrapper {
    margin-bottom: 25px;
}

.ip-reply-form-nested {
    margin-top: 15px;
    margin-bottom: 0;
    padding-left: 0;
}

.ip-reply-form {
    display: flex;
    gap: 12px;
}

.ip-reply-form-avatar {
    flex-shrink: 0;
}

.ip-reply-form-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.ip-reply-form-body {
    flex: 1;
    min-width: 0;
}

.ip-reply-textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ip-reply-textarea:focus {
    outline: none;
    border-color: var(--ip-primary);
    box-shadow: 0 0 0 3px rgba(200, 42, 239, 0.1);
}

.ip-reply-textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.ip-reply-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.ip-reply-char-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.ip-reply-char-count.near-limit {
    color: #ffa726;
}

.ip-reply-char-count.at-limit {
    color: #ef5350;
}

.ip-reply-form-actions {
    display: flex;
    gap: 10px;
}

/* Login prompt */
.ip-reply-login-prompt {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 8px;
}

/* ==========================================================================
   Reply List
   ========================================================================== */

.ip-replies-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ==========================================================================
   Single Reply
   ========================================================================== */

.ip-reply {
    display: flex;
    gap: 12px;
}

.ip-reply-nested {
    margin-left: 52px;
    padding-left: 20px;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
}

.ip-reply-avatar {
    flex-shrink: 0;
}

.ip-reply-avatar img,
.ip-reply-avatar .ip-profile-picture {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Support emoji avatars (span elements) in replies */
.ip-reply-avatar .ip-profile-picture--default,
.ip-reply-avatar span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
}

.ip-reply-main {
    flex: 1;
    min-width: 0;
}

.ip-reply-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.ip-reply-author {
    font-weight: 600;
    color: #fff;
    font-size: 14px;
}

.ip-reply-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 3px;
    letter-spacing: 0.5px;
}

.ip-badge-author {
    background: var(--ip-primary);
    color: #fff;
}

.ip-badge-dev {
    background: #4caf50;
    color: #fff;
}

.ip-reply-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.ip-reply-edited {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    font-style: italic;
}

.ip-reply-content {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    line-height: 1.6;
}

.ip-reply-content p {
    margin: 0 0 10px 0;
}

.ip-reply-content p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Reply Footer & Actions
   ========================================================================== */

.ip-reply-footer {
    margin-top: 10px;
}

.ip-reply-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Voting */
.ip-reply-voting {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ip-reply-vote {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 10px;
}

.ip-reply-vote:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.ip-reply-vote:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.ip-reply-vote.active {
    color: var(--ip-primary);
}

.ip-reply-vote-up.active {
    color: #66bb6a;
}

.ip-reply-vote-down.active {
    color: #ef5350;
}

.ip-reply-vote-score {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    min-width: 20px;
    text-align: center;
}

/* Action buttons */
.ip-reply-action {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.ip-reply-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.ip-action-icon {
    font-size: 12px;
}

.ip-action-delete:hover {
    background: rgba(239, 83, 80, 0.15);
    color: #ef5350;
}

.ip-action-report:hover {
    background: rgba(255, 167, 38, 0.15);
    color: #ffa726;
}

/* ==========================================================================
   Nested Forms & Children
   ========================================================================== */

.ip-nested-form-container {
    margin-top: 10px;
}

.ip-nested-form-container:empty {
    display: none;
}

.ip-reply-children {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ==========================================================================
   Load More
   ========================================================================== */

.ip-replies-load-more {
    text-align: center;
    margin-top: 20px;
}

.ip-load-more-replies {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ip-replies-remaining {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   Button Styles
   ========================================================================== */

.ip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.ip-btn-primary {
    background: var(--ip-primary);
    color: #fff;
}

.ip-btn-primary:hover {
    background: #a01fc7;
}

.ip-btn-primary:disabled {
    background: rgba(200, 42, 239, 0.5);
    cursor: not-allowed;
}

.ip-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ip-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.ip-btn-text {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    padding: 8px 12px;
}

.ip-btn-text:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Edit Mode
   ========================================================================== */

.ip-reply.editing .ip-reply-content {
    display: none;
}

.ip-reply-edit-form {
    margin-top: 8px;
}

.ip-reply-edit-form .ip-reply-textarea {
    min-height: 60px;
}

.ip-reply-edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* ==========================================================================
   States
   ========================================================================== */

.ip-reply.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.ip-reply.is-deleted {
    display: none;
}

.ip-reply-form.is-submitting .ip-submit-reply {
    pointer-events: none;
}

.ip-reply-form.is-submitting .ip-submit-reply::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ip-spin 0.6s linear infinite;
    margin-left: 8px;
}

@keyframes ip-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.ip-replies-empty {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.5);
}

.ip-replies-empty-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.ip-replies-empty-text {
    font-size: 14px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 600px) {
    .ip-reply-nested {
        margin-left: 20px;
        padding-left: 15px;
    }
    
    .ip-reply-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .ip-reply-form-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .ip-reply-form-actions {
        width: 100%;
        justify-content: flex-end;
    }
}


/* Action icons use SVG for a clean, consistent UI */
.ip-action-icon svg {
    width: 14px;
    height: 14px;
    display: block;
}
