/* Add this CSS to your theme's CSS file or in a <style> block */

/* Comment Form Styles - Compatible with GenZ Theme */
.comment-form-container {
    margin: 40px 0;
}

.comment-form {
    border: 1px solid var(--border-color-primary, #e5e7eb);
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-white, #ffffff);
    transition: all 0.3s ease;
}

.comment-form:focus-within {
    border-color: var(--color-brand-1, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.comment-tabs {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    border-bottom: 1px solid var(--border-color-primary, #e5e7eb);
    background: var(--bg-gray-50, #f9fafb);
    padding: 0;
    min-height: 48px;
}

.tabs-left {
    display: flex;
    align-items: stretch;
}

.tabs-right {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 8px 12px;
    border-left: 1px solid var(--border-color-primary, #e5e7eb);
}

.comment-tab {
    padding: 12px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-gray-600, #6b7280);
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.comment-tab.active {
    color: var(--text-gray-900, #111827);
    border-bottom-color: var(--color-brand-1, #3b82f6);
    background: var(--bg-white, #ffffff);
}

.comment-tab:hover {
    color: var(--text-gray-900, #111827);
    background: var(--bg-gray-100, #f3f4f6);
}

.comment-textarea {
    width: 100%;
    border: none;
    resize: vertical;
    min-height: 120px;
    padding: 16px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg-white, #ffffff);
    color: var(--text-gray-900, #111827);
    outline: none;
}

.comment-textarea::placeholder {
    color: var(--text-gray-500, #6b7280);
}

.comment-preview {
    padding: 16px;
    min-height: 120px;
    background: var(--bg-white, #ffffff);
    color: var(--text-gray-900, #111827);
    font-size: 14px;
    line-height: 1.6;
    border-radius: 0 0 16px 16px;
}

.comment-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 16px;
    background: var(--bg-gray-50, #f9fafb);
    border-top: 1px solid var(--border-color-primary, #e5e7eb);
}

.toolbar-left {
    display: flex;
    gap: 8px;
    align-items: center;
}

.toolbar-btn {
    padding: 8px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 6px;
    color: var(--text-gray-600, #6b7280);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
}

.toolbar-btn:hover:not(:disabled) {
    background: var(--bg-gray-200, #e5e7eb);
    color: var(--text-gray-900, #111827);
}

.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.file-upload {
    position: relative;
    overflow: hidden;
}

.submit-btn {
    padding: 8px 16px;
    background: var(--color-brand-1, #3b82f6);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.submit-btn:hover:not(:disabled) {
    background: var(--color-brand-2, #2563eb);
    transform: translateY(-1px);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.markdown-guide {
    font-size: 12px;
    color: var(--text-gray-600, #6b7280);
    margin-bottom: 8px;
    padding: 8px 0;
}

.markdown-guide a {
    color: var(--color-brand-1, #3b82f6);
    text-decoration: none;
}

.markdown-guide a:hover {
    text-decoration: underline;
}

.upload-progress {
    margin-top: 8px;
    padding: 12px 16px;
    background: var(--bg-blue-50, #eff6ff);
    border: 1px solid var(--border-blue-200, #bfdbfe);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-blue-700, #1d4ed8);
}

/* Markdown Preview Styles */
.comment-preview h1,
.comment-preview h2,
.comment-preview h3,
.comment-preview h4,
.comment-preview h5,
.comment-preview h6 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    color: var(--text-gray-900, #111827);
}

.comment-preview h1 {
    font-size: 1.5em;
    border-bottom: 1px solid var(--border-color-primary, #e5e7eb);
    padding-bottom: 8px;
}

.comment-preview h2 { font-size: 1.3em; }
.comment-preview h3 { font-size: 1.1em; }
.comment-preview h4 { font-size: 1em; }
.comment-preview h5 { font-size: 0.9em; }
.comment-preview h6 { font-size: 0.8em; }

.comment-preview p {
    margin: 12px 0;
    line-height: 1.6;
}

.comment-preview code {
    background: var(--bg-gray-100, #f3f4f6);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9em;
    color: var(--text-red-600, #dc2626);
}

.comment-preview pre {
    background: var(--bg-gray-900, #111827);
    color: var(--text-gray-100, #f9fafb);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
    line-height: 1.4;
}

.comment-preview pre code {
    background: none;
    padding: 0;
    color: inherit;
    border-radius: 0;
}

.comment-preview blockquote {
    border-left: 4px solid var(--color-brand-1, #3b82f6);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-gray-600, #6b7280);
    font-style: italic;
}

.comment-preview ul,
.comment-preview ol {
    padding-left: 24px;
    margin: 12px 0;
}

.comment-preview li {
    margin: 4px 0;
    line-height: 1.6;
}

.comment-preview a {
    color: var(--color-brand-1, #3b82f6);
    text-decoration: none;
}

.comment-preview a:hover {
    text-decoration: underline;
}

.comment-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.comment-preview table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
}

.comment-preview th,
.comment-preview td {
    border: 1px solid var(--border-color-primary, #e5e7eb);
    padding: 8px 12px;
    text-align: left;
}

.comment-preview th {
    background: var(--bg-gray-50, #f9fafb);
    font-weight: 600;
}

.comment-preview hr {
    border: none;
    border-top: 2px solid var(--border-color-primary, #e5e7eb);
    margin: 24px 0;
}

/* Dark Mode Support */
[data-theme="dark"] .comment-form,
.theme-night .comment-form {
    --bg-white: #1f2937;
    --bg-gray-50: #374151;
    --bg-gray-100: #4b5563;
    --bg-gray-200: #6b7280;
    --bg-gray-900: #0f172a;
    --text-gray-900: #f9fafb;
    --text-gray-600: #d1d5db;
    --text-gray-500: #9ca3af;
    --border-color-primary: #4b5563;
    --color-brand-1: #60a5fa;
    --color-brand-2: #3b82f6;
    --text-red-600: #f87171;
    --bg-blue-50: #1e3a8a;
    --border-blue-200: #3b82f6;
    --text-blue-700: #93c5fd;
}

/* Responsive Design */
@media (max-width: 768px) {
    .comment-form-container {
        margin: 20px 0;
    }

    .comment-textarea {
        min-height: 100px;
        padding: 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .comment-tabs {
        flex-direction: column;
        gap: 8px;
        padding: 8px;
    }

    .tabs-left {
        justify-content: center;
    }

    .tabs-right {
        justify-content: center;
        padding: 0;
        flex-wrap: wrap;
    }

    .comment-toolbar {
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }

    .submit-btn {
        width: 100%;
        padding: 12px;
    }

    .comment-tab {
        flex: 1;
        text-align: center;
        min-width: 80px;
    }
}

/* Focus and Animation States */
.comment-form {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comment-textarea:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Loading States */
.submit-btn.loading {
    position: relative;
    color: transparent;
}

.submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s ease-in-out infinite;
}

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

/* ════════════════════════════════════════════════════════════════════════════
   Techalyst overrides — match the site: cyan accent, larger form type, and a
   comment listing aligned with the article body (one step smaller = secondary).
   Listing rules are typography-only (no box/layout changes) on purpose.
   Site convention: default = dark, html.theme-day = light, html.theme-night = dark.
   ════════════════════════════════════════════════════════════════════════════ */

/* Re-accent the form: light = teal (#0a8a8a), dark = cyan (#6ddfdf) */
.comment-form { --color-brand-1: #0a8a8a; --color-brand-2: #0a8a8a; }
.theme-night .comment-form { --color-brand-1: #6ddfdf; --color-brand-2: #34c0c0; }

.comment-form:focus-within { box-shadow: 0 0 0 3px rgba(10,138,138,0.12); }
.theme-night .comment-form:focus-within { box-shadow: 0 0 0 3px rgba(109,223,223,0.14); }
.comment-textarea:focus { box-shadow: none; }

/* Larger, more readable form chrome */
.comment-tab { font-size: 15px; }
.toolbar-btn { font-size: 15px; }
.comment-textarea { font-size: 15px; line-height: 1.6; }
.comment-preview { font-size: 15px; line-height: 1.7; }
.markdown-guide { font-size: 13px; }

/* Submit button — readable in both themes (light text on teal, dark text on cyan) */
.submit-btn { font-size: 15px; font-weight: 600; background: #0a8a8a; color: #fff; }
.submit-btn:hover:not(:disabled) { background: #097a7a; }
.theme-night .submit-btn { background: linear-gradient(90deg, #6ddfdf, #34c0c0); color: #06302f; }
.theme-night .submit-btn:hover:not(:disabled) { background: linear-gradient(90deg, #7fe7e7, #3fcccc); }

/* ── Comment listing typography (dark default) — match the article body exactly ── */
/* Section headings ("All comments", "Leave a Comment", "Product Discussions") — bright, like article headings */
.box-comments h3, .box-comments h4, .section-header h4 { color: #fff; font-weight: 700; }
.list-comments-single .author-info h6 { color: #e6edf3; font-size: 1rem; font-weight: 600; }
.list-comments-single .author-info span { color: rgba(255,255,255,0.5); }

/* Flatten the comment card so text sits on the same backdrop as the article body
   (the old bg-gray-850 box made the identical #c7d0dd read dimmer). */
.list-comments-single .text-comment {
    font-size: 16px;
    line-height: 1.72;
    color: #c7d0dd;
    background: transparent !important;
    border: 0 !important;
    padding: 0;
}
/* Colour the rendered markdown explicitly so nothing inherits a stray colour */
.list-comments-single .text-comment,
.list-comments-single .text-comment p,
.list-comments-single .text-comment li,
.list-comments-single .text-comment span { color: #c7d0dd; }
.list-comments-single .text-comment > :last-child { margin-bottom: 0; }
.list-comments-single .text-comment :not(pre) > code {
    font-size: 0.86em;
    background: rgba(109,223,223,0.1);
    color: #9fe9e9;
    padding: 0.12em 0.42em;
    border-radius: 5px;
}

/* ── Comment listing typography (light mode) ── */
.theme-day .box-comments h3, .theme-day .box-comments h4, .theme-day .section-header h4 { color: #0d1117; }
.theme-day .list-comments-single .author-info h6 { color: #0d1117; }
.theme-day .list-comments-single .author-info span { color: rgba(0,0,0,0.5); }
.theme-day .list-comments-single .text-comment,
.theme-day .list-comments-single .text-comment p,
.theme-day .list-comments-single .text-comment li,
.theme-day .list-comments-single .text-comment span { color: #3c4555; }
.theme-day .list-comments-single .text-comment :not(pre) > code { background: rgba(10,138,138,0.09); color: #0a6a6a; }
