/**
 * StressTherapist Comments Widget Styles
 * Matches existing --st-* CSS variables from article templates
 *
 * @package StressTherapist\Comments
 * @version 1.0.0
 */

/* ============================================
   CSS Variables (fallbacks for standalone use)
   ============================================ */
.st-comments-section {
    --st-accent-red: #d63939;
    --st-accent-red-hover: #bf0606;
    --st-accent-red-light: rgba(214, 57, 57, 0.1);
    --st-text-primary: #333333;
    --st-text-secondary: #666666;
    --st-text-light: #999999;
    --st-bg-light: #F8F9FA;
    --st-bg-white: #FFFFFF;
    --st-border-light: #E0E0E0;
    --st-font-family: 'Lato', 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ============================================
   Base Container
   ============================================ */
.st-comments-section {
    padding: 60px 0;
    max-width: 800px;
    margin: 0 auto;
    font-family: var(--st-font-family);
}

.st-comments-section .st-container {
    max-width: 100%;
}

.st-comments-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--st-text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.st-comment-count {
    font-size: 20px;
    font-weight: 400;
    color: var(--st-text-light);
}

/* ============================================
   Engagement Prompt
   ============================================ */
.st-comment-prompt {
    background: linear-gradient(135deg, var(--st-accent-red-light) 0%, rgba(214, 57, 57, 0.03) 100%);
    border-left: 4px solid var(--st-accent-red);
    padding: 16px 20px;
    margin-bottom: 24px;
    border-radius: 0 8px 8px 0;
}

.st-prompt-text {
    margin: 0;
    color: var(--st-text-primary);
    font-size: 16px;
    font-weight: 500;
}

/* ============================================
   Comment Form
   ============================================ */
.st-comment-form {
    background: var(--st-bg-light);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 32px;
}

.st-comment-form h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px;
    color: var(--st-text-primary);
}

.st-form-row {
    margin-bottom: 12px;
}

.st-textarea-row {
    position: relative;
}

.st-comment-form input[type="text"],
.st-comment-form input[type="email"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--st-border-light);
    border-radius: 8px;
    font-family: var(--st-font-family);
    font-size: 15px;
    background: var(--st-bg-white);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.st-comment-form input:focus,
.st-comment-form textarea:focus {
    outline: none;
    border-color: var(--st-accent-red);
    box-shadow: 0 0 0 3px var(--st-accent-red-light);
}

.st-comment-form input::placeholder,
.st-comment-form textarea::placeholder {
    color: var(--st-text-light);
}

.st-comment-form textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--st-border-light);
    border-radius: 8px;
    font-family: var(--st-font-family);
    font-size: 15px;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    background: var(--st-bg-white);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.st-char-count {
    position: absolute;
    bottom: 10px;
    right: 12px;
    font-size: 12px;
    color: var(--st-text-light);
    pointer-events: none;
}

.st-char-warning {
    color: #f59e0b !important;
}

.st-char-error {
    color: var(--st-accent-red) !important;
}

.st-notify-row {
    display: none;
    margin-top: 8px;
}

.st-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--st-text-secondary);
    cursor: pointer;
}

.st-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--st-accent-red);
}

.st-form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 16px;
}

.st-btn-submit {
    padding: 12px 28px;
    background: var(--st-accent-red);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: var(--st-font-family);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.st-btn-submit:hover:not(:disabled) {
    background: var(--st-accent-red-hover);
}

.st-btn-submit:active:not(:disabled) {
    transform: scale(0.98);
}

.st-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.st-btn-cancel {
    display: none;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--st-border-light);
    border-radius: 6px;
    font-family: var(--st-font-family);
    font-size: 14px;
    color: var(--st-text-secondary);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.st-btn-cancel:hover {
    border-color: var(--st-text-secondary);
    color: var(--st-text-primary);
}

.st-form-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    display: none;
}

.st-form-message:not(:empty) {
    display: block;
}

.st-form-message.st-success {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.st-form-message.st-error {
    background: var(--st-accent-red-light);
    color: #c62828;
    border: 1px solid rgba(214, 57, 57, 0.2);
}

/* ============================================
   Comments List
   ============================================ */
.st-comments-list {
    min-height: 100px;
}

.st-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--st-text-light);
    font-size: 15px;
}

.st-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--st-border-light);
    border-top-color: var(--st-accent-red);
    border-radius: 50%;
    animation: st-spin 0.8s linear infinite;
}

@keyframes st-spin {
    to { transform: rotate(360deg); }
}

.st-no-comments,
.st-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--st-text-light);
    font-size: 15px;
}

.st-error p {
    margin: 0 0 12px;
}

.st-btn-retry {
    padding: 8px 20px;
    background: var(--st-accent-red);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

/* ============================================
   Individual Comment
   ============================================ */
.st-comment {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--st-border-light);
    transition: background 0.3s;
}

.st-comment:last-child {
    border-bottom: none;
}

.st-comment.st-highlight {
    background: rgba(214, 57, 57, 0.06);
    margin-left: -12px !important;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
    border-radius: 8px;
    border-bottom-color: transparent;
}

.st-comment-pinned {
    background: linear-gradient(135deg, rgba(214, 57, 57, 0.06) 0%, transparent 100%);
    margin-left: -12px !important;
    margin-right: -12px;
    padding: 16px 12px;
    border-radius: 8px;
    border: 1px solid rgba(214, 57, 57, 0.15);
    border-bottom: 1px solid rgba(214, 57, 57, 0.15) !important;
}

.st-comment-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
}

.st-comment-body {
    flex: 1;
    min-width: 0;
}

.st-comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.st-comment-author {
    font-weight: 600;
    color: var(--st-text-primary);
    font-size: 15px;
}

.st-pinned-badge {
    background: var(--st-accent-red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.st-comment-time {
    font-size: 13px;
    color: var(--st-text-light);
    text-decoration: none;
    transition: color 0.2s;
}

.st-comment-time:hover {
    color: var(--st-accent-red);
}

.st-comment-content {
    color: var(--st-text-secondary);
    line-height: 1.6;
    font-size: 15px;
}

.st-comment-content p {
    margin: 0 0 8px;
}

.st-comment-content p:last-child {
    margin-bottom: 0;
}

.st-comment-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.st-btn-like,
.st-btn-reply,
.st-btn-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: none;
    border: none;
    color: var(--st-text-light);
    font-family: var(--st-font-family);
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s, background 0.2s;
}

.st-btn-like:hover,
.st-btn-reply:hover,
.st-btn-link:hover {
    color: var(--st-accent-red);
    background: var(--st-accent-red-light);
}

.st-btn-like.st-liked {
    color: var(--st-accent-red);
}

.st-btn-like:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.st-like-count {
    min-width: 12px;
    text-align: left;
}

.st-icon-heart,
.st-icon-link {
    flex-shrink: 0;
}

/* ============================================
   Pagination
   ============================================ */
.st-pagination {
    margin-top: 24px;
    text-align: center;
}

.st-pagination-inner {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.st-page-btn {
    padding: 8px 12px;
    min-width: 36px;
    border: 1px solid var(--st-border-light);
    background: var(--st-bg-white);
    color: var(--st-text-secondary);
    font-family: var(--st-font-family);
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.st-page-btn:hover {
    border-color: var(--st-accent-red);
    color: var(--st-accent-red);
}

.st-page-btn.st-page-active {
    background: var(--st-accent-red);
    border-color: var(--st-accent-red);
    color: white;
}

.st-page-ellipsis {
    padding: 0 8px;
    color: var(--st-text-light);
}

.st-page-prev,
.st-page-next {
    padding: 8px 14px;
}

/* ============================================
   Toast Notification
   ============================================ */
.st-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--st-text-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: var(--st-font-family);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.st-toast-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .st-comments-section {
        padding: 40px 16px;
    }

    .st-comments-title {
        font-size: 24px;
    }

    .st-comment-form {
        padding: 20px 16px;
    }

    .st-comment {
        gap: 10px;
    }

    .st-comment-avatar {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 12px;
    }

    .st-comment-author {
        font-size: 14px;
    }

    .st-comment-content {
        font-size: 14px;
    }

    .st-comment-actions {
        flex-wrap: wrap;
        gap: 4px;
    }

    .st-btn-like,
    .st-btn-reply,
    .st-btn-link {
        padding: 4px 8px;
        font-size: 12px;
    }

    .st-form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .st-btn-submit,
    .st-btn-cancel {
        width: 100%;
        text-align: center;
    }

    .st-page-btn {
        padding: 6px 10px;
        min-width: 32px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .st-comments-section {
        padding: 32px 12px;
    }

    .st-comment-prompt {
        padding: 12px 16px;
    }

    .st-prompt-text {
        font-size: 14px;
    }

    .st-pagination-inner {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .st-comment-form,
    .st-comment-actions,
    .st-pagination,
    .st-comment-prompt {
        display: none !important;
    }

    .st-comment {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
