/* css/threads.css */
/* Threaded Comments System Styles - Production version */

/* -----------------------------------------------------
   Main Form Styles
   ----------------------------------------------------- */

#thread-form {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.thread-form-fields {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.thread-form-fields input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95em;
    background-color: var(--bgcolor, #fff);
    color: var(--text-color, #333);
}

.thread-form-fields input:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 3px rgba(74, 144, 217, 0.3);
}

.thread-form-fields input::placeholder {
    color: #999;
}

.thread-form-subscribe {
    margin-bottom: 10px;
}

.thread-form-subscribe .checkbox-label {
    display: flex;
    align-items: center;
    font-size: 0.9em;
    color: #666;
}

.thread-form-subscribe .checkbox-label input[type="checkbox"] {
    margin-right: 6px;
}

.thread-form-comment textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95em;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
    background-color: var(--bgcolor, #fff);
    color: var(--text-color, #333);
}

.thread-form-comment textarea:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 3px rgba(74, 144, 217, 0.3);
}

.thread-form-comment textarea::placeholder {
    color: #999;
}

.thread-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    position: relative;
}

/* Main submit button - matches reply button style */
.thread-submit-btn {
    background-color: #4a90d9;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    font-family: inherit;
    transition: background-color 0.2s;
}

.thread-submit-btn:hover {
    background-color: #3a7bc8;
}

.thread-submit-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Small screens - stack form fields */
@media (max-width: 768px) {
    .thread-form-fields {
        flex-direction: column;
    }
}

/* -----------------------------------------------------
   Thread Section Container
   ----------------------------------------------------- */

.thread-section {
    margin-top: 30px;
    border: 2px solid #ccc;
    border-radius: 4px;
    padding: 15px;
    background-color: var(--bgcolor, #fff);
}

.no-comments {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.loading {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* -----------------------------------------------------
   Individual Comment Styles
   ----------------------------------------------------- */

.thread-comment {
    margin-bottom: 20px;
    padding: 12px;
    background-color: rgba(128, 128, 128, 0.08);
    border-radius: 6px;
    border-left: 3px solid #4a90d9;
}

.thread-reply {
    margin: 10px 0 10px 30px;
    padding: 10px;
    background-color: rgba(128, 128, 128, 0.12);
    border-radius: 6px;
    border-left: 3px solid #7cb342;
    font-size: 0.95em;
}

.thread-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.thread-author {
    font-weight: bold;
    color: var(--link-color, #4a90d9);
}

.thread-date {
    font-size: 0.85em;
    color: #888;
}

.thread-content {
    line-height: 1.5;
    word-wrap: break-word;
}

/* -----------------------------------------------------
   Reply Toggle and Actions
   ----------------------------------------------------- */

.thread-actions {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(128, 128, 128, 0.2);
}

.thread-reply-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--link-color, #4a90d9);
    text-decoration: none;
    font-size: 0.9em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.thread-reply-toggle:hover {
    background-color: rgba(74, 144, 217, 0.1);
    text-decoration: none;
}

.thread-reply-toggle .material-icons {
    font-size: 16px !important;
}

/* -----------------------------------------------------
   Replies Container
   ----------------------------------------------------- */

.thread-replies {
    margin-top: 10px;
    padding-left: 10px;
    border-left: 2px solid rgba(128, 128, 128, 0.2);
}

/* -----------------------------------------------------
   Add Reply Toggle
   ----------------------------------------------------- */

.thread-reply-action {
    margin: 10px 0 5px 30px;
}

.thread-add-reply-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--link-color, #4a90d9);
    text-decoration: none;
    font-size: 0.9em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.thread-add-reply-toggle:hover {
    background-color: rgba(74, 144, 217, 0.1);
    text-decoration: none;
}

/* -----------------------------------------------------
   Inline Reply Form
   ----------------------------------------------------- */

.thread-reply-form {
    margin: 15px 0 5px 30px;
    padding: 12px;
    background-color: rgba(128, 128, 128, 0.05);
    border-radius: 6px;
    border: 1px dashed #ccc;
}

.thread-reply-form input,
.thread-reply-form textarea {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95em;
    box-sizing: border-box;
    background-color: var(--bgcolor, #fff);
    color: var(--text-color, #333);
}

.thread-reply-form input:focus,
.thread-reply-form textarea:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 3px rgba(74, 144, 217, 0.3);
}

.thread-reply-form input::placeholder,
.thread-reply-form textarea::placeholder {
    color: #999;
}

.thread-reply-form textarea {
    resize: vertical;
    min-height: 60px;
}

.thread-reply-form .reply-submit {
    background-color: #4a90d9;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.thread-reply-form .reply-submit:hover {
    background-color: #3a7bc8;
}

.thread-reply-form .reply-submit:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Small screens adjustments */
@media (max-width: 768px) {
    .thread-reply {
        margin-left: 15px;
    }
    
    .thread-reply-form {
        margin-left: 15px;
    }
    
    .thread-header {
        flex-direction: column;
        gap: 4px;
    }
}

/* -----------------------------------------------------
   Dark Mode Support
   ----------------------------------------------------- */

@media (prefers-color-scheme: dark) {
    .thread-comment {
        background-color: rgba(255, 255, 255, 0.05);
    }
    
    .thread-reply {
        background-color: rgba(255, 255, 255, 0.08);
    }
    
    .thread-reply-form {
        background-color: rgba(255, 255, 255, 0.03);
        border-color: #555;
    }
    
    .thread-reply-form input,
    .thread-reply-form textarea,
    .thread-form-fields input,
    .thread-form-comment textarea {
        border-color: #555;
    }
    
    .emoticon-menu > button {
        border-color: #555;
    }
}

/* Explicit dark mode class support */
.dark-mode .thread-comment,
body.dark .thread-comment {
    background-color: rgba(255, 255, 255, 0.05);
}

.dark-mode .thread-reply,
body.dark .thread-reply {
    background-color: rgba(255, 255, 255, 0.08);
}

/* -----------------------------------------------------
   Animation for expanding/collapsing
   ----------------------------------------------------- */

.thread-replies {
    overflow: hidden;
}

/* -----------------------------------------------------
   Essay Links in Comments
   ----------------------------------------------------- */

.essay-link {
    color: var(--link-color, #4a90d9);
    text-decoration: none;
    border-bottom: 1px dotted var(--link-color, #4a90d9);
}

.essay-link:hover {
    text-decoration: none;
    border-bottom-style: solid;
}

.essay-link-broken {
    color: #999;
    font-style: italic;
}
