:root {
    --spocd-green: #83D54D;
    --spocd-green-dark: #6db83d;
    --spocd-green-soft: #f4fbea;
    --spocd-border: #dddddd;
    --spocd-text: #333333;
    --spocd-muted: #6b6b6b;
    --spocd-error: #a52626;
    --spocd-error-bg: #fff1f1;
}

.spocd-integration-source[hidden] {
    display: none !important;
}

.spocd-integration-fallback {
    display: block !important;
    margin: 20px 0;
}

/*
 * Integrated wpDiscuz composer controls.
 * These selectors intentionally live under #wpdcom so the feature feels like
 * part of the existing comment form rather than a separate application.
 */
#wpdcom .spocd-composer-notices {
    margin: 0 0 10px;
}

#wpdcom .spocd-inline-notice,
.spocd-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    padding: 11px 13px;
    border-radius: 5px;
    font-size: 16px !important;
    line-height: 1.4;
}

#wpdcom .spocd-inline-notice strong,
.spocd-notice strong {
    font-size: 16px !important;
}

#wpdcom .spocd-inline-notice-success,
.spocd-notice-success {
    border: 1px solid var(--spocd-green-dark);
    background: var(--spocd-green-soft);
    color: #222;
}

#wpdcom .spocd-inline-notice-error,
.spocd-notice-error {
    border: 1px solid var(--spocd-error);
    background: var(--spocd-error-bg);
    color: var(--spocd-error);
}

#wpdcom .spocd-inline-notice a,
.spocd-notice a {
    font-weight: 700;
}

#wpdcom .spocd-composer-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid var(--spocd-border);
    border-radius: 4px;
    background: #fafafa;
}

#wpdcom .spocd-composer-copy {
    color: #555;
    font-size: 15px !important;
    line-height: 1.35;
}

#wpdcom .spocd-composer-copy strong {
    display: block;
    margin-bottom: 2px;
    color: #333;
    font-size: 17px !important;
}

#wpdcom .spocd-start-inline,
#wpdcom .spocd-cancel-inline {
    appearance: none;
    min-height: 42px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

#wpdcom .spocd-start-inline {
    flex: 0 0 auto;
    padding: 8px 15px;
    border: 1px solid var(--spocd-green-dark);
    background: var(--spocd-green);
    color: #000;
}

#wpdcom .spocd-start-inline:hover,
#wpdcom .spocd-start-inline:focus {
    filter: brightness(.96);
}

#wpdcom .spocd-discussion-mode-panel {
    margin: 0 0 10px;
    padding: 13px 14px 10px;
    border: 1px solid var(--spocd-border);
    border-left: 4px solid var(--spocd-green);
    border-radius: 4px;
    background: #fff;
}

#wpdcom .spocd-discussion-mode-panel[hidden] {
    display: none !important;
}

#wpdcom .spocd-mode-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 11px;
}

#wpdcom .spocd-mode-head strong {
    color: #333;
    font-size: 18px !important;
}

#wpdcom .spocd-cancel-inline {
    min-height: 36px;
    padding: 6px 11px;
    border: 1px solid #aaa;
    background: #fff;
    color: #333;
    font-size: 15px;
}

#wpdcom .spocd-inline-field {
    margin-bottom: 10px;
}

#wpdcom .spocd-inline-field label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-size: 16px !important;
    font-weight: 700;
}

#wpdcom .spocd-inline-field input[type="text"] {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--spocd-border);
    border-radius: 3px;
    background: #fff;
    color: #333;
    font-family: inherit;
    font-size: 17px;
}

#wpdcom .spocd-inline-field input[type="text"]:focus {
    border-color: var(--spocd-green-dark);
    outline: 2px solid rgba(131, 213, 77, .24);
    outline-offset: 1px;
}

#wpdcom .spocd-inline-help {
    margin: 5px 0 0;
    color: var(--spocd-muted);
    font-size: 14px !important;
    line-height: 1.35;
}

#wpdcom .spocd-discussion-mode .wc_comm_submit {
    min-width: 175px;
}

/*
 * GIPHY insertion is provided by wpDiscuz and produces a wpDiscuz shortcode.
 * Standalone Discussion posts do not render that shortcode, so hide the
 * GIPHY control only while Discussion mode is active. It returns
 * automatically when the mode class is removed.
 */
#wpdcom .spocd-discussion-mode .ql-giphy,
#wpdcom .spocd-discussion-mode [data-wpde_button_name="giphy"] {
    display: none !important;
}

/*
 * Quick Comments keep the real wpDiscuz Media Uploader. Discussion mode swaps
 * in a dedicated photo paperclip in the exact same editor location so the two
 * upload systems never fight over the same file input.
 */
#wpdcom .spocd-upload-wrap {
    display: none !important;
    align-items: center;
}

#wpdcom .spocd-discussion-mode .wmu-upload-wrap {
    display: none !important;
}

#wpdcom .spocd-discussion-mode .spocd-upload-wrap {
    display: inline-flex !important;
}

#wpdcom .spocd-upload-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: #999;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

#wpdcom .spocd-upload-label:hover,
#wpdcom .spocd-upload-label:focus-within {
    color: #666;
}

#wpdcom .spocd-photo-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

#wpdcom .spocd-photo-preview {
    margin: 10px 0 2px 68px;
    padding: 10px 12px;
    border: 1px solid #d8d8d8;
    border-radius: 4px;
    background: #fafafa;
}

#wpdcom .spocd-photo-preview[hidden] {
    display: none !important;
}

#wpdcom .spocd-photo-preview-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 9px;
}

#wpdcom .spocd-photo-preview-head strong {
    color: #333;
    font-size: 15px !important;
}

#wpdcom .spocd-remove-photos {
    appearance: none;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #aaa;
    border-radius: 4px;
    background: #fff;
    color: #333;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
}

#wpdcom .spocd-remove-photos:hover,
#wpdcom .spocd-remove-photos:focus {
    background: #f2f2f2;
}

#wpdcom .spocd-photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 150px));
    justify-content: start;
    gap: 10px;
}

#wpdcom .spocd-photo-preview-item {
    min-width: 0;
    max-width: 150px;
}

#wpdcom .spocd-photo-preview-item img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 1px solid #dddddd;
    border-radius: 4px;
    background: #eee;
}

/*
 * Filenames are intentionally not shown beneath Discussion thumbnails.
 * SPO's wpDiscuz theme globally enlarges spans, which made long screenshot
 * names collide visually. The filename remains available in the image title
 * tooltip while the visible preview stays clean and simple.
 */
#comments #wpdcom .spocd-photo-preview-item span,
#wpdcom .spocd-photo-preview-item span {
    display: none !important;
}

/* Integrated list between the main composer and the normal comment thread. */
#wpdcom .spocd-inline-discussions {
    margin: 22px 0 20px;
    padding-top: 13px;
    border-top: 2px solid var(--spocd-green);
    color: var(--spocd-text);
}

#wpdcom .spocd-inline-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 9px;
}

#wpdcom .spocd-inline-heading h3 {
    margin: 0 0 2px;
    color: #333;
    font-size: 22px;
    line-height: 1.25;
}

#wpdcom .spocd-inline-heading p {
    margin: 0;
    color: var(--spocd-muted);
    font-size: 14px !important;
    line-height: 1.35;
}

#wpdcom .spocd-secondary-link {
    flex: 0 0 auto;
    font-size: 15px !important;
    font-weight: 700;
}

#wpdcom .spocd-discussion-list {
    overflow: hidden;
    border: 1px solid var(--spocd-border);
    border-radius: 4px;
    background: #fff;
}

#wpdcom .spocd-discussion-card {
    margin: 0;
    padding: 14px 16px;
    border: 0;
    border-bottom: 1px solid #ececec;
    background: #fff;
}

#wpdcom .spocd-discussion-card:last-child {
    border-bottom: 0;
}

#wpdcom .spocd-card-title {
    margin: 0 0 5px;
    font-size: 20px;
    line-height: 1.3;
}

#wpdcom .spocd-card-title a {
    color: #3478b8;
    text-decoration: none;
}

#wpdcom .spocd-card-title a:hover,
#wpdcom .spocd-card-title a:focus {
    text-decoration: underline;
}

#wpdcom .spocd-card-meta,
#wpdcom .spocd-card-cam {
    margin: 0 0 6px;
    color: var(--spocd-muted);
    font-size: 14px !important;
    line-height: 1.35;
}

#wpdcom .spocd-card-meta span,
#wpdcom .spocd-card-meta time,
#wpdcom .spocd-card-cam span {
    font-size: 14px !important;
}

#wpdcom .spocd-card-excerpt {
    margin: 8px 0 10px;
    color: #444;
    font-size: 16px !important;
    line-height: 1.45;
}

#wpdcom .spocd-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#wpdcom .spocd-reply-count {
    color: #555;
    font-size: 14px !important;
    font-weight: 700;
}

#wpdcom .spocd-read-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 7px 13px;
    border: 1px solid var(--spocd-green-dark);
    border-radius: 4px;
    background: var(--spocd-green);
    color: #000 !important;
    font-size: 15px !important;
    font-weight: 700;
    text-decoration: none !important;
}

#wpdcom .spocd-empty-state {
    padding: 15px 16px;
    background: #fafafa;
    color: #555;
    text-align: left;
}

#wpdcom .spocd-empty-state strong,
#wpdcom .spocd-empty-state span {
    display: block;
    font-size: 15px !important;
}

/* Photos attached to Discussions. */
.spocd-discussion-media {
    margin: 10px 0 13px;
}

.spocd-discussion-media-card {
    position: relative;
    max-width: 520px;
}

.spocd-discussion-photo {
    margin: 0;
}

.spocd-discussion-photo img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.spocd-discussion-media-card .spocd-discussion-photo img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
}

.spocd-more-photos {
    display: inline-block;
    margin-top: 5px;
    color: #666;
    font-size: 13px !important;
    font-weight: 700;
}

.spocd-discussion-media-single {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 12px;
    margin-top: 18px;
}

.spocd-discussion-media-single .spocd-discussion-photo img {
    width: 100%;
    max-height: 720px;
    object-fit: contain;
    background: #f6f6f6;
}

.spocd-discussion-media-single .spocd-discussion-photo-link {
    display: block;
    border-radius: 6px;
    cursor: zoom-in;
    text-decoration: none;
}

.spocd-discussion-media-single .spocd-discussion-photo-link:focus-visible {
    outline: 3px solid #83D54D;
    outline-offset: 4px;
}

body.spocd-lightbox-open {
    overflow: hidden;
}

.spocd-lightbox[hidden] {
    display: none !important;
}

.spocd-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 70px 92px 70px;
    background: rgba(0, 0, 0, 0.92);
}

.spocd-lightbox-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.spocd-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    background: #111;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.spocd-lightbox-close,
.spocd-lightbox-prev,
.spocd-lightbox-next {
    appearance: none;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    background: #fff;
    color: #111;
    cursor: pointer;
    font-family: inherit;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
}

.spocd-lightbox-close:hover,
.spocd-lightbox-close:focus-visible,
.spocd-lightbox-prev:hover,
.spocd-lightbox-prev:focus-visible,
.spocd-lightbox-next:hover,
.spocd-lightbox-next:focus-visible {
    background: #83D54D;
    color: #000;
    outline: none;
}

.spocd-lightbox-close {
    position: absolute;
    top: 16px;
    right: 18px;
    min-height: 48px;
    padding: 10px 18px;
}

.spocd-lightbox-prev,
.spocd-lightbox-next {
    position: absolute;
    top: 50%;
    min-width: 54px;
    min-height: 52px;
    padding: 10px 12px;
    transform: translateY(-50%);
}

.spocd-lightbox-prev {
    left: 16px;
}

.spocd-lightbox-next {
    right: 16px;
}

.spocd-lightbox-counter {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    margin: 0;
    padding: 7px 13px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
}

@media (max-width: 700px) {
    .spocd-lightbox {
        padding: 66px 12px 82px;
    }

    .spocd-lightbox-close {
        top: 10px;
        right: 10px;
    }

    .spocd-lightbox-prev,
    .spocd-lightbox-next {
        top: auto;
        bottom: 14px;
        min-height: 46px;
        transform: none;
    }

    .spocd-lightbox-prev {
        left: 10px;
    }

    .spocd-lightbox-next {
        right: 10px;
    }

    .spocd-lightbox-counter {
        bottom: 22px;
        font-size: 14px;
    }
}

/* Standalone discussion/archive pages. */
.spocd-page {
    box-sizing: border-box;
    width: min(100% - 32px, 920px);
    margin: 35px auto;
    color: var(--spocd-text);
    font-size: 18px;
    line-height: 1.55;
}

.spocd-page * {
    box-sizing: border-box;
}

.spocd-single-discussion,
.spocd-replies,
.spocd-archive-header {
    padding: 24px;
    border: 1px solid var(--spocd-border);
    border-radius: 8px;
    background: #fff;
}

.spocd-single-header h1,
.spocd-archive-header h1 {
    margin: 0 0 8px;
    font-size: clamp(30px, 5vw, 42px);
    line-height: 1.15;
}

.spocd-single-kicker {
    margin: 0 0 6px;
    color: var(--spocd-green-dark);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.spocd-single-meta,
.spocd-single-cam,
.spocd-card-cam,
.spocd-archive-header > p {
    color: var(--spocd-muted);
}

.spocd-single-meta,
.spocd-single-cam {
    margin: 4px 0;
    font-size: 16px;
}

.spocd-single-content {
    margin-top: 22px;
    font-size: 19px;
}

.spocd-back-wrap {
    margin-top: 0;
}

.spocd-back-link,
.spocd-secondary-link {
    font-weight: 700;
}

.spocd-replies {
    margin-top: 20px;
}

.spocd-replies h2 {
    margin-top: 0;
    font-size: 27px;
}

.spocd-closed-notice {
    padding: 12px 14px;
    border: 1px solid #ddd;
    background: #fafafa;
}

.spocd-archive-list {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.spocd-archive-list .spocd-discussion-card {
    padding: 18px;
    border: 1px solid var(--spocd-border);
    border-radius: 7px;
    background: #fff;
}

.spocd-archive-list .spocd-card-title {
    margin: 0 0 6px;
    font-size: 23px;
    line-height: 1.25;
}

.spocd-archive-list .spocd-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.spocd-archive-list .spocd-read-button,
.spocd-notice-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 15px;
    border: 1px solid var(--spocd-green-dark);
    border-radius: 5px;
    background: var(--spocd-green);
    color: #000 !important;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none !important;
}

.spocd-pagination {
    margin-top: 24px;
}

@media (max-width: 700px) {
    #wpdcom .spocd-composer-entry {
        align-items: stretch;
        flex-direction: column;
    }

    #wpdcom .spocd-start-inline {
        width: 100%;
    }

    #wpdcom .spocd-inline-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    #wpdcom .spocd-card-footer {
        align-items: stretch;
        flex-direction: column;
    }

    #wpdcom .spocd-read-button {
        width: 100%;
    }

    #wpdcom .spocd-discussion-mode .wc_comm_submit {
        min-width: 0;
    }

    .spocd-page {
        width: min(100% - 20px, 920px);
        margin: 20px auto;
    }

    .spocd-single-discussion,
    .spocd-replies,
    .spocd-archive-header {
        padding: 18px;
    }
}

/* Archive card polish outside #wpdcom. */
.spocd-archive-list .spocd-card-title a {
    color: #3478b8;
    text-decoration: none;
}

.spocd-archive-list .spocd-card-title a:hover,
.spocd-archive-list .spocd-card-title a:focus {
    text-decoration: underline;
}

.spocd-archive-list .spocd-card-meta,
.spocd-archive-list .spocd-card-cam {
    margin: 0 0 7px;
    color: var(--spocd-muted);
    font-size: 15px;
}

.spocd-archive-list .spocd-card-excerpt {
    margin: 12px 0 15px;
}

.spocd-archive-list .spocd-reply-count {
    font-weight: 700;
}

@media (max-width: 600px) {
    #wpdcom .spocd-photo-preview {
        margin-left: 0;
    }

    #wpdcom .spocd-photo-preview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Draft recovery notices for the regular wpDiscuz Quick Comment composer. */
#wpdcom .spocd-draft-notice {
    margin: 0 0 10px;
    padding: 9px 12px;
    border: 1px solid var(--spocd-green-dark);
    border-radius: 4px;
    background: var(--spocd-green-soft);
    color: #333;
    font-size: 15px !important;
    font-weight: 700;
    line-height: 1.4;
}

#wpdcom .spocd-draft-notice[hidden] {
    display: none !important;
}

/* Thirty-minute frontend Discussion editing. */
.spocd-edit-root {
    margin-top: 12px;
}

.spocd-edit-root[hidden],
.spocd-edit-panel[hidden],
.spocd-edit-notice[hidden] {
    display: none !important;
}

.spocd-edit-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.spocd-edit-trigger,
.spocd-edit-save,
.spocd-edit-cancel {
    appearance: none;
    min-height: 40px;
    padding: 8px 13px;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.spocd-edit-trigger,
.spocd-edit-save {
    border: 1px solid var(--spocd-green-dark);
    background: var(--spocd-green);
    color: #000;
}

.spocd-edit-trigger:disabled,
.spocd-edit-save:disabled {
    cursor: not-allowed;
    opacity: .65;
}

.spocd-edit-cancel {
    border: 1px solid #aaa;
    background: #fff;
    color: #333;
}

.spocd-edit-time {
    color: var(--spocd-muted);
    font-size: 14px;
    font-weight: 700;
}

.spocd-edit-panel {
    margin-top: 12px;
    padding: 15px;
    border: 1px solid var(--spocd-border);
    border-left: 4px solid var(--spocd-green);
    border-radius: 6px;
    background: #fafafa;
}

.spocd-edit-field {
    margin-bottom: 13px;
}

.spocd-edit-field label,
.spocd-edit-label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-size: 16px;
    font-weight: 700;
}

.spocd-edit-field input[type="text"],
.spocd-edit-body {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cfcfcf;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-family: inherit;
    font-size: 17px;
    line-height: 1.5;
}

.spocd-edit-field input[type="text"] {
    min-height: 46px;
}

.spocd-edit-body {
    min-height: 170px;
    overflow-wrap: anywhere;
}

.spocd-edit-field input[type="text"]:focus,
.spocd-edit-body:focus {
    border-color: var(--spocd-green-dark);
    outline: 2px solid rgba(131, 213, 77, .24);
    outline-offset: 1px;
}

.spocd-edit-help {
    margin: 0 0 12px;
    color: var(--spocd-muted);
    font-size: 14px;
    line-height: 1.4;
}

.spocd-edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.spocd-edit-notice {
    margin-top: 12px;
    padding: 9px 11px;
    border: 1px solid var(--spocd-green-dark);
    border-radius: 4px;
    background: var(--spocd-green-soft);
    color: #333;
    font-size: 15px;
    font-weight: 700;
}

.spocd-edit-notice.spocd-edit-notice-error {
    border-color: var(--spocd-error);
    background: var(--spocd-error-bg);
    color: var(--spocd-error);
}

@media (max-width: 600px) {
    .spocd-edit-toolbar,
    .spocd-edit-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .spocd-edit-trigger,
    .spocd-edit-save,
    .spocd-edit-cancel {
        width: 100%;
    }
}

/*
 * SEO-friendly wpDiscuz pagination presentation.
 *
 * The existing SPO AJAX Load More script keeps the real numbered pagination
 * in the document. Once that enhancement has initialized successfully,
 * JavaScript adds .spocd-load-more-ready and we move the numbered navigation
 * off the visual canvas instead of deleting it. If Load More is unavailable,
 * this class is never added and the native pagination stays visible.
 */
#wpdcom.spocd-load-more-ready .wpdiscuz-comment-pagination {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
