/**
 * JeSuspended Comments - Frontend Styles
 * 
 * @package JeSuspended_Comments
 */

/* ==========================================================================
   Variables
   ========================================================================== */
:root {
    --jsc-primary: #6366f1;
    --jsc-primary-hover: #4f46e5;
    --jsc-secondary: #64748b;
    --jsc-success: #22c55e;
    --jsc-danger: #ef4444;
    --jsc-warning: #f59e0b;
    --jsc-info: #3b82f6;
    
    --jsc-bg: #ffffff;
    --jsc-bg-secondary: #f8fafc;
    --jsc-bg-tertiary: #f1f5f9;
    --jsc-border: #e2e8f0;
    --jsc-text: #1e293b;
    --jsc-text-secondary: #64748b;
    --jsc-text-muted: #94a3b8;
    
    --jsc-radius: 8px;
    --jsc-radius-sm: 4px;
    --jsc-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --jsc-shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    
    --jsc-transition: 0.2s ease;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --jsc-bg: #1e293b;
        --jsc-bg-secondary: #334155;
        --jsc-bg-tertiary: #475569;
        --jsc-border: #475569;
        --jsc-text: #f1f5f9;
        --jsc-text-secondary: #cbd5e1;
        --jsc-text-muted: #94a3b8;
    }
}

/* ==========================================================================
   Base Styles
   ========================================================================== */
.jsc-comments-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--jsc-text);
    max-width: 100%;
    margin: 30px 0;
}

.jsc-comments-wrapper * {
    box-sizing: border-box;
}

/* ==========================================================================
   Header
   ========================================================================== */
.jsc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--jsc-border);
    flex-wrap: wrap;
    gap: 10px;
}

.jsc-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--jsc-text);
}

.jsc-title .jsc-icon {
    color: var(--jsc-primary);
}

.jsc-sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

.jsc-sort label {
    font-size: 13px;
    color: var(--jsc-text-secondary);
}

.jsc-sort-select {
    padding: 6px 12px;
    border: 1px solid var(--jsc-border);
    border-radius: var(--jsc-radius-sm);
    background: var(--jsc-bg);
    color: var(--jsc-text);
    font-size: 13px;
    cursor: pointer;
    transition: border-color var(--jsc-transition);
}

.jsc-sort-select:hover,
.jsc-sort-select:focus {
    border-color: var(--jsc-primary);
    outline: none;
}

/* ==========================================================================
   Form
   ========================================================================== */
.jsc-form-wrapper {
    background: var(--jsc-bg-secondary);
    border-radius: var(--jsc-radius);
    padding: 20px;
    margin-bottom: 25px;
}

.jsc-comment-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.jsc-form-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.jsc-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.jsc-user-info .jsc-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.jsc-user-name {
    font-weight: 500;
    color: var(--jsc-text);
}

.jsc-guest-fields {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}

.jsc-guest-fields .jsc-field {
    flex: 1;
    min-width: 150px;
}

.jsc-guest-fields input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--jsc-border);
    border-radius: var(--jsc-radius-sm);
    background: var(--jsc-bg);
    color: var(--jsc-text);
    font-size: 14px;
    transition: border-color var(--jsc-transition);
}

.jsc-guest-fields input::placeholder {
    color: #fff !important;
    opacity: 1 !important;
}

.jsc-guest-fields input:focus {
    border-color: var(--jsc-primary);
    outline: none;
}

.jsc-textarea-wrapper {
    position: relative;
}

.jsc-textarea-wrapper textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid var(--jsc-border);
    border-radius: var(--jsc-radius-sm);
    background: var(--jsc-bg);
    color: var(--jsc-text);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: border-color var(--jsc-transition);
}

.jsc-textarea-wrapper textarea::placeholder {
    color: #fff !important;
    opacity: 1 !important;
}

.jsc-textarea-wrapper textarea:focus {
    border-color: var(--jsc-primary);
    outline: none;
}

.jsc-formatting-toolbar {
    display: flex;
    gap: 5px;
    padding: 8px;
    background: var(--jsc-bg-tertiary);
    border-radius: 0 0 var(--jsc-radius-sm) var(--jsc-radius-sm);
    margin-top: -1px;
}

.jsc-format-btn {
    padding: 5px 10px;
    border: 1px solid var(--jsc-border);
    background: var(--jsc-bg);
    color: var(--jsc-text);
    cursor: pointer;
    border-radius: var(--jsc-radius-sm);
    transition: all var(--jsc-transition);
    font-size: 14px;
    font-weight: 600;
    min-width: 32px;
}

.jsc-format-btn:hover {
    background: var(--jsc-primary);
    color: #fff;
    border-color: var(--jsc-primary);
}

.jsc-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.jsc-form-options {
    display: flex;
    align-items: center;
    gap: 15px;
}

.jsc-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--jsc-text-secondary);
}

.jsc-checkbox input {
    cursor: pointer;
}

.jsc-form-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.jsc-char-count {
    font-size: 12px;
    color: var(--jsc-text-muted);
}

.jsc-form-message {
    padding: 10px 15px;
    border-radius: var(--jsc-radius-sm);
    font-size: 13px;
}

.jsc-form-message.success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--jsc-success);
    border: 1px solid var(--jsc-success);
}

.jsc-form-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--jsc-danger);
    border: 1px solid var(--jsc-danger);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.jsc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--jsc-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--jsc-transition);
    text-decoration: none;
}

.jsc-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.jsc-btn-primary {
    background: var(--jsc-primary);
    color: #fff;
}

.jsc-btn-primary:hover:not(:disabled) {
    background: var(--jsc-primary-hover);
}

.jsc-btn-secondary {
    background: var(--jsc-bg-tertiary);
    color: var(--jsc-text);
    border: 1px solid var(--jsc-border);
}

.jsc-btn-secondary:hover:not(:disabled) {
    background: var(--jsc-border);
}

/* ==========================================================================
   Comments List
   ========================================================================== */
.jsc-comments-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.jsc-no-comments {
    text-align: center;
    padding: 40px 20px;
    color: var(--jsc-text-muted);
}

/* ==========================================================================
   Single Comment
   ========================================================================== */
.jsc-comment {
    position: relative;
}

.jsc-comment-inner {
    display: flex;
    gap: 15px;
}

.jsc-comment-avatar {
    flex-shrink: 0;
}

.jsc-comment-avatar img,
.jsc-comment-avatar .jsc-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.jsc-comment-content {
    flex: 1;
    min-width: 0;
}

.jsc-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.jsc-comment-author {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.jsc-author-link,
.jsc-author-name {
    font-weight: 600;
    color: var(--jsc-text);
    text-decoration: none;
}

.jsc-author-link:hover {
    color: var(--jsc-primary);
}

.jsc-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.jsc-badge-admin {
    background: rgba(239, 68, 68, 0.1);
    color: var(--jsc-danger);
}

.jsc-badge-editor {
    background: rgba(99, 102, 241, 0.1);
    color: var(--jsc-primary);
}

.jsc-badge-author {
    background: rgba(34, 197, 94, 0.1);
    color: var(--jsc-success);
}

.jsc-badge-guest {
    background: var(--jsc-bg-tertiary);
    color: var(--jsc-text-muted);
}

.jsc-comment-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--jsc-text-muted);
}

.jsc-edited-label {
    color: var(--jsc-text-muted);
    font-style: italic;
}

.jsc-comment-anchor {
    color: var(--jsc-text-muted);
    text-decoration: none;
}

.jsc-comment-anchor:hover {
    color: var(--jsc-primary);
}

.jsc-comment-body {
    position: relative;
    margin-bottom: 12px;
}

.jsc-comment-text {
    color: var(--jsc-text);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.jsc-comment-text p {
    margin: 0 0 10px;
}

.jsc-comment-text p:last-child {
    margin-bottom: 0;
}

/* Spoiler styles */
.jsc-spoiler-full .jsc-comment-text {
    filter: blur(5px);
    user-select: none;
    pointer-events: none;
}

.jsc-spoiler-full.revealed .jsc-comment-text {
    filter: none;
    user-select: auto;
    pointer-events: auto;
}

.jsc-spoiler-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--jsc-radius-sm);
}

.jsc-spoiler-full.revealed .jsc-spoiler-overlay {
    display: none;
}

.jsc-spoiler-reveal {
    padding: 8px 16px;
    background: var(--jsc-bg);
    border: 1px solid var(--jsc-border);
    border-radius: var(--jsc-radius-sm);
    color: var(--jsc-text);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--jsc-transition);
}

.jsc-spoiler-reveal:hover {
    background: var(--jsc-primary);
    color: #fff;
    border-color: var(--jsc-primary);
}

/* Inline spoiler */
.jsc-spoiler {
    background: var(--jsc-text);
    color: var(--jsc-text);
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
    transition: all var(--jsc-transition);
}

.jsc-spoiler.revealed {
    background: var(--jsc-bg-tertiary);
    color: var(--jsc-text);
}

.jsc-spoiler .jsc-spoiler-content {
    display: none;
}

.jsc-spoiler.revealed .jsc-spoiler-label {
    display: none;
}

.jsc-spoiler.revealed .jsc-spoiler-content {
    display: inline;
}

/* Quote */
.jsc-quote {
    margin: 10px 0;
    padding: 10px 15px;
    border-left: 3px solid var(--jsc-primary);
    background: var(--jsc-bg-secondary);
    color: var(--jsc-text-secondary);
    font-style: italic;
}

/* Code */
.jsc-comment-text code {
    padding: 2px 6px;
    background: var(--jsc-bg-tertiary);
    border-radius: 3px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
}

.jsc-comment-text pre {
    margin: 10px 0;
    padding: 15px;
    background: var(--jsc-bg-tertiary);
    border-radius: var(--jsc-radius-sm);
    overflow-x: auto;
}

.jsc-comment-text pre code {
    padding: 0;
    background: none;
}

/* Mention */
.jsc-mention {
    color: var(--jsc-primary);
    font-weight: 500;
    text-decoration: none;
}

.jsc-mention:hover {
    text-decoration: underline;
}

.jsc-mention-unknown {
    color: var(--jsc-text-muted);
}

/* Link */
.jsc-link {
    color: var(--jsc-info);
    text-decoration: none;
    word-break: break-all;
}

.jsc-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Comment Actions
   ========================================================================== */
.jsc-comment-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.jsc-likes {
    display: flex;
    align-items: center;
    gap: 5px;
}

.jsc-like-btn,
.jsc-dislike-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: none;
    background: transparent;
    color: var(--jsc-text-muted);
    cursor: pointer;
    border-radius: var(--jsc-radius-sm);
    transition: all var(--jsc-transition);
    font-size: 13px;
}

.jsc-like-btn:hover:not(:disabled),
.jsc-dislike-btn:hover:not(:disabled) {
    background: var(--jsc-bg-tertiary);
}

.jsc-like-btn.active {
    color: var(--jsc-success);
}

.jsc-dislike-btn.active {
    color: var(--jsc-danger);
}

.jsc-like-btn:disabled,
.jsc-dislike-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.jsc-action-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.jsc-reply-btn,
.jsc-link-btn,
.jsc-report-btn,
.jsc-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: none;
    background: transparent;
    color: var(--jsc-text-muted);
    cursor: pointer;
    font-size: 12px;
    transition: all var(--jsc-transition);
    border-radius: var(--jsc-radius-sm);
}

.jsc-reply-btn:hover,
.jsc-link-btn:hover,
.jsc-edit-btn:hover {
    color: var(--jsc-primary);
    background: var(--jsc-bg-tertiary);
}

.jsc-report-btn:hover {
    color: var(--jsc-danger);
    background: rgba(239, 68, 68, 0.1);
}

/* ==========================================================================
   Replies
   ========================================================================== */
.jsc-replies-wrapper {
    margin-top: 15px;
    padding-left: 20px;
    border-left: 2px solid var(--jsc-border);
}

.jsc-show-replies {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: none;
    background: var(--jsc-bg-secondary);
    color: var(--jsc-primary);
    cursor: pointer;
    font-size: 13px;
    border-radius: var(--jsc-radius-sm);
    transition: all var(--jsc-transition);
}

.jsc-show-replies:hover {
    background: var(--jsc-bg-tertiary);
}

.jsc-show-replies.expanded .jsc-icon {
    transform: rotate(180deg);
}

.jsc-replies-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.jsc-replies-list .jsc-comment-avatar img {
    width: 36px;
    height: 36px;
}

/* Reply form */
.jsc-reply-form-wrapper {
    margin-top: 15px;
    padding: 15px;
    background: var(--jsc-bg-secondary);
    border-radius: var(--jsc-radius);
}

.jsc-reply-form-wrapper .jsc-textarea-wrapper textarea {
    min-height: 80px;
}

.jsc-cancel-reply {
    margin-left: 10px;
}

/* Edit form */
.jsc-edit-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.jsc-edit-form .jsc-textarea-wrapper textarea,
.jsc-edit-textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid var(--jsc-border);
    border-radius: var(--jsc-radius-sm);
    background: var(--jsc-bg);
    color: var(--jsc-text);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: border-color var(--jsc-transition);
}

.jsc-edit-form .jsc-textarea-wrapper textarea:focus,
.jsc-edit-textarea:focus {
    border-color: var(--jsc-primary);
    outline: none;
}

.jsc-edit-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.jsc-edit-actions .jsc-char-count {
    margin-right: auto;
}

.jsc-cancel-edit {
    margin-left: 0;
}

/* ==========================================================================
   Load More
   ========================================================================== */
.jsc-load-more-wrapper {
    text-align: center;
    margin-top: 25px;
}

.jsc-load-more {
    min-width: 200px;
}

.jsc-load-more.loading {
    pointer-events: none;
}

/* ==========================================================================
   Notice
   ========================================================================== */
.jsc-notice {
    padding: 15px 20px;
    border-radius: var(--jsc-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.jsc-notice-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--jsc-info);
    border: 1px solid var(--jsc-info);
}

.jsc-login-link {
    color: var(--jsc-info);
    font-weight: 500;
    text-decoration: underline;
}

/* ==========================================================================
   Modal
   ========================================================================== */
.jsc-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.jsc-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.jsc-modal-content {
    position: relative;
    background: var(--jsc-bg);
    border-radius: var(--jsc-radius);
    box-shadow: var(--jsc-shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.jsc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--jsc-border);
}

.jsc-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.jsc-modal-close {
    padding: 5px 10px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--jsc-text-muted);
    cursor: pointer;
    line-height: 1;
}

.jsc-modal-close:hover {
    color: var(--jsc-text);
}

.jsc-modal-body {
    padding: 20px;
}

.jsc-form-group {
    margin-bottom: 15px;
}

.jsc-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--jsc-text);
}

.jsc-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    font-weight: normal;
}

.jsc-form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--jsc-border);
    border-radius: var(--jsc-radius-sm);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.jsc-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .jsc-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .jsc-comment-inner {
        gap: 10px;
    }
    
    .jsc-comment-avatar img {
        width: 40px;
        height: 40px;
    }
    
    .jsc-comment-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .jsc-comment-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .jsc-replies-wrapper {
        padding-left: 10px;
    }
    
    .jsc-guest-fields {
        flex-direction: column;
    }
    
    .jsc-form-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes jsc-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.jsc-comment.new {
    animation: jsc-fade-in 0.3s ease;
}

@keyframes jsc-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.jsc-loading {
    animation: jsc-pulse 1.5s ease-in-out infinite;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.jsc-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: var(--jsc-text);
    color: var(--jsc-bg);
    border-radius: var(--jsc-radius);
    box-shadow: var(--jsc-shadow-lg);
    z-index: 99999;
    animation: jsc-fade-in 0.3s ease;
}

.jsc-toast.success {
    background: var(--jsc-success);
}

.jsc-toast.error {
    background: var(--jsc-danger);
}