/* basic, simple and clean styles (SEO-friendly markup) */

.ts-topics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 16px;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .ts-topics-grid {
    gap: 14px;
    padding: 10px;
  }
}

.ts-topic-card {
  position: relative;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #eee;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 140px;
}

.ts-topic-card .ts-image-link {
  display: block;
  width: 100%;
  overflow: hidden;
  background: #f3f3f3;
}

.ts-topic-card img.ts-thumb {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.ts-card-body { padding: 12px; flex:1; }
.ts-title { font-size: 18px; margin: 0 0 8px; line-height:1.2; }
.ts-title a { color: #222; text-decoration: none; }
.ts-desc { color:#666; margin:0; font-size:14px; }

.ts-badge {
  position:absolute;
  left:8px; top:8px;
  background:#ff6b6b; color:#fff;
  padding:4px 8px;
  border-radius:4px;
  font-size:12px;
}

.ts-pending { opacity: 0.85; }

/* loader */
.ts-loader { text-align:center; padding:16px; color:#777; }

/* admin form / table minor improvements */
.ts-add-topic-form input[type="text"], .ts-add-topic-form textarea {
  width:100%; padding:8px; border:1px solid #ddd; border-radius:4px;
}
.ts-success { background:#e7f8ea; padding:8px; border:1px solid #bfe6c8; border-radius:4px; margin-bottom:12px; }
.ts-error { background:#ffecec; padding:8px; border:1px solid #f5c2c2; border-radius:4px; margin-bottom:12px;}

.ts-meta {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 13px;
    color: #555;
}
.ts-post-count {
    background: #f3f3f3;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 600;
}
.ts-badge {
    background: #fff5cc;
    color: #b97300;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
}



.ts-topic-image-wrap {
    position: relative;
    overflow: hidden;
}

.ts-topic-image-wrap .ts-thumb {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ts-pending-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;

    background: rgba(255, 170, 0, 0.95);
    color: #fff;

    padding: 6px 10px;
    border-radius: 8px;

    font-size: 13px;
    font-weight: 700;

    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.ts-pending-label {
    display: inline-block;

    margin: 6px 0 10px;

    padding: 5px 9px;

    border-radius: 6px;

    background: #fff3cd;
    color: #856404;

    font-size: 12px;
    font-weight: 600;
}

.ts-topic-card.ts-pending {
    position: relative;
}



/* =========================================================
   TS TOPIC CREATE MODAL
   ========================================================= */

.ts-add-topic-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.ts-add-topic-modal.show {
    display: flex;
}


/* Overlay */

.ts-add-topic-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(3px);
}


/* Modal content */

.ts-add-topic-modal-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;

    background: #fff;
    border-radius: 18px;
    padding: 28px;

    box-sizing: border-box;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.35);

    animation: tsTopicModalShow 0.22s ease;
}


@keyframes tsTopicModalShow {

    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

}


/* Close */

.ts-add-topic-modal-close {
    position: absolute;
    top: 12px;
    left: 12px;

    width: 36px;
    height: 36px;

    border: 0;
    border-radius: 50%;

    background: #f1f1f1;
    color: #333;

    font-size: 20px;
    line-height: 36px;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}


.ts-add-topic-modal-close:hover {
    background: #e3e3e3;
    transform: rotate(90deg);
}


/* وقتی Modal باز است */

body.ts-add-topic-modal-open {
    overflow: hidden;
}


/* =========================================================
   FORM
   ========================================================= */

.ts-add-topic-modal .ts-add-topic-form {
    margin: 0;
}


.ts-add-topic-modal .ts-add-topic-form > p {
    margin-bottom: 18px;
}


.ts-add-topic-modal .ts-add-topic-form label {
    display: inline-block;
    margin-bottom: 6px;
    font-weight: 600;
}


.ts-add-topic-modal .ts-add-topic-form input[type="text"],
.ts-add-topic-modal .ts-add-topic-form textarea {
    width: 100%;
    box-sizing: border-box;

    border: 1px solid #d7d7d7;
    border-radius: 10px;

    padding: 11px 13px;

    font-size: 15px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}


.ts-add-topic-modal .ts-add-topic-form input[type="text"]:focus,
.ts-add-topic-modal .ts-add-topic-form textarea:focus {
    border-color: #2271b1;

    box-shadow:
        0 0 0 3px rgba(34, 113, 177, 0.12);

    outline: none;
}


/* =========================================================
   IMAGE PREVIEW
   ========================================================= */

#ts_image_preview {
    margin-top: 12px;
}


#ts_image_preview img {
    display: block;

    max-width: 100%;
    max-height: 300px;

    margin: 0 auto;

    border-radius: 12px;

    object-fit: contain;

    box-shadow:
        0 4px 18px rgba(0, 0, 0, 0.12);
}


/* Crop buttons */

#ts_crop_controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}


#ts_crop_controls button {
    cursor: pointer;
}


/* =========================================================
   UPLOAD PROGRESS
   ========================================================= */

.ts-topic-upload-progress {
    display: none;

    margin-top: 15px;

    padding: 14px 16px;

    border-radius: 12px;

    background: #f6f8fa;

    border: 1px solid #e1e5e8;
}


.ts-topic-upload-progress.show {
    display: block;
}


.ts-topic-upload-progress-text {
    display: flex;

    justify-content: space-between;
    align-items: center;

    margin-bottom: 8px;

    font-size: 14px;
    font-weight: 600;
}


.ts-topic-upload-progress-percent {
    font-weight: 700;
}


/* Progress bar */

.ts-topic-upload-progress-track {
    width: 100%;
    height: 9px;

    overflow: hidden;

    background: #e5e7eb;

    border-radius: 20px;
}


.ts-topic-upload-progress-bar {
    width: 0;
    height: 100%;

    border-radius: 20px;

    background: #2271b1;

    transition: width 0.15s ease;
}


/* Upload complete */

.ts-topic-upload-complete {
    display: none;

    margin-top: 10px;

    padding: 10px 12px;

    border-radius: 9px;

    background: #ecfdf3;

    border: 1px solid #b7ebc6;

    color: #16733a;

    font-size: 14px;

    font-weight: 600;
}


.ts-topic-upload-complete.show {
    display: block;
}


/* =========================================================
   FORM MESSAGES
   ========================================================= */

.ts-topic-form-message {
    margin-top: 14px;

    padding: 11px 13px;

    border-radius: 9px;

    font-size: 14px;
}


.ts-topic-form-message.ts-success {
    background: #ecfdf3;
    border: 1px solid #b7ebc6;
    color: #16733a;
}


.ts-topic-form-message.ts-error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #b42318;
}


.ts-topic-form-message.ts-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}


/* =========================================================
   PENDING LABEL
   ========================================================= */

.ts-topic-card {
    position: relative;
}


/*
 * Pending label روی تصویر
 */

.ts-topic-pending-label {
    position: absolute;

    top: 12px;
    left: 12px;
    right: auto;

    z-index: 5;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    padding: 6px 11px;

    border-radius: 20px;

    background: rgba(255, 193, 7, 0.95);

    color: #3d2b00;

    font-size: 12px;

    font-weight: 700;

    line-height: 1;

    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.18);

    backdrop-filter: blur(3px);
}


/*
 * اگر تصویر وجود نداشته باشد
 */

.ts-topic-card.ts-pending {
    position: relative;
}


/* =========================================================
   PENDING CARD
   ========================================================= */

.ts-topic-card.ts-pending {
    border: 2px solid rgba(255, 193, 7, 0.45);
}


.ts-topic-card.ts-pending::after {
    content: "";

    position: absolute;

    inset: 0;

    pointer-events: none;

    border-radius: inherit;

    box-shadow:
        inset 0 0 0 1px rgba(255, 193, 7, 0.08);
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 700px) {

    .ts-add-topic-modal {
        padding: 10px;
    }


    .ts-add-topic-modal-content {
        max-height: 94vh;

        padding: 22px 16px;

        border-radius: 14px;
    }


    .ts-add-topic-modal-close {
        top: 8px;
        left: 8px;
    }


    .ts-topic-pending-label {
        top: 8px;
        left: 8px;
        right: auto;

        padding: 5px 9px;

        font-size: 11px;
    }

}


.ts-topic-pending-text {
    margin: 8px 0;

    padding: 7px 10px;

    border-radius: 8px;

    background: #fff8e1;

    border: 1px solid #ffe082;

    color: #7a5700;

    font-size: 12px;

    font-weight: 600;
}


.ts-topic-card.ts-pending {
    position: relative;
}




/* ==========================================================================
   Create Topic Modal - Upload Progress
   ========================================================================== */

.ts-topic-upload-progress {
    display: none;
    width: 100%;
    margin-top: 15px;
    padding: 12px;
    border-radius: 10px;
    background: #f5f5f5;
    box-sizing: border-box;
}


.ts-topic-upload-progress.show {
    display: block;
}


/* --------------------------------------------------------------------------
   Progress Text
   -------------------------------------------------------------------------- */

.ts-topic-upload-progress-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.8;
}


.ts-topic-upload-progress-percent {
    font-weight: 700;
    white-space: nowrap;
}


/* --------------------------------------------------------------------------
   Progress Track
   -------------------------------------------------------------------------- */

.ts-topic-upload-progress-track {
    width: 100%;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #ddd;
}


/* --------------------------------------------------------------------------
   Progress Bar
   -------------------------------------------------------------------------- */

.ts-topic-upload-progress-bar {
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: #2271b1;
    transition: width 0.15s ease;
}


/* --------------------------------------------------------------------------
   Upload Complete
   -------------------------------------------------------------------------- */

.ts-topic-upload-complete {
    display: none;
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    background: #e8f7ed;
    color: #187a3d;
    font-size: 13px;
    font-weight: 600;
}


.ts-topic-upload-complete.show {
    display: block;
}


/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.ts-add-topic-modal-open {
    overflow: hidden;
}


.ts-add-topic-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
}


.ts-add-topic-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}


.ts-add-topic-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}


.ts-add-topic-modal-content {
    position: relative;
    z-index: 2;
    width: min(600px, calc(100% - 30px));
    max-height: calc(100vh - 30px);
    overflow-y: auto;
    padding: 25px;
    border-radius: 14px;
    background: #fff;
    box-sizing: border-box;
}


/* --------------------------------------------------------------------------
   Preview
   -------------------------------------------------------------------------- */

#ts_image_preview {
    margin-top: 12px;
    text-align: center;
}


#ts_image_preview img {
    display: block;
    width: 100%;
    max-width: 500px;
    max-height: 300px;
    margin: 0 auto;
    object-fit: contain;
    border-radius: 10px;
}


/* --------------------------------------------------------------------------
   Form Message
   -------------------------------------------------------------------------- */

.ts-topic-form-message {
    margin-top: 12px;
    line-height: 1.8;
}


.ts-topic-form-message.ts-error {
    padding: 10px;
    border-radius: 8px;
    background: #fdecec;
    color: #b42318;
}


.ts-topic-form-message.ts-success {
    padding: 10px;
    border-radius: 8px;
    background: #e8f7ed;
    color: #187a3d;
}



/* =========================================================
   دکمه ساخت تاپیک
   پایین سمت چپ صفحه
   ========================================================= */

.ts-create-topic-floating {
    position: fixed;
    left: 20px;
    bottom: 20px;

    z-index: 9999;

    margin: 0;
    padding: 0;

    direction: ltr;
}

.ts-create-topic-floating .ts-create-topic-button {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 6px;

    margin: 0;
    padding: 10px 16px;

    border: 0;
    border-radius: 10px;

    cursor: pointer;

    font-size: 14px;
    font-weight: 600;

    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);

    white-space: nowrap;
}

#ts_tozihat::placeholder {
    color: #aaa;
    font-size: 12px;
    font-weight: 400;
    opacity: 1;
}

.ts-topic-legal-warning {
    margin: 8px 0 0;
    padding: 8px 10px;
    font-size: 10px;
    line-height: 1.8;
    color: #ff0000;
    text-align: center;
}


/* =========================================================
   Topic Share Button
   همان ظاهر دکمه Share کارت‌های زیرتاپیک
========================================================= */

.ts-topic-card .ts-topic-share-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 60;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 50%;
  background: rgba(255,255,255,.88);
  box-shadow: 0 2px 7px rgba(0,0,0,.16);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}

.ts-topic-card .ts-topic-share-btn svg {
  width: 17px;
  height: 17px;
  display: block;
}

.ts-topic-card .ts-topic-share-btn:hover {
  transform: scale(1.08);
  background: rgba(255,255,255,1);
  box-shadow: 0 3px 10px rgba(0,0,0,.20);
}

.ts-topic-card .ts-topic-share-btn.ts-share-copied {
  color: #000;
}

.ts-topic-card.ts-share-target {
  z-index: 100;
  animation: tsTopicShareTarget 2.2s ease-out;
}

@keyframes tsTopicShareTarget {
  0% { box-shadow: 0 0 0 rgba(0,0,0,0); }
  20% { box-shadow: 0 0 22px rgba(0,0,0,.35); }
  65% { box-shadow: 0 0 22px rgba(0,0,0,.35); }
  100% { box-shadow: 0 0 0 rgba(0,0,0,0); }
}

.ts-topic-share-copy-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 99999;
  padding: 8px 14px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-size: 13px;
  pointer-events: none;
}

/* =========================================================
 * TarinShow public search
 * ========================================================= */
.ts-search-page {
    direction: rtl;
}

.ts-search-align-frame {
    width: min(100% - 32px, 760px);
    margin-inline: auto;
    padding: 36px 0 60px;
}

.ts-search-header {
    margin-bottom: 28px;
    text-align: center;
}

.ts-search-header h1 {
    margin: 0 0 8px;
    font-size: clamp(24px, 4vw, 34px);
}

.ts-search-header p {
    margin: 0;
    opacity: .72;
}

.ts-search-section {
    margin-top: 34px;
}

.ts-search-section > h2 {
    margin: 0 0 14px;
    font-size: 22px;
}

.ts-search-results {
    display: grid;
    gap: 12px;
}

.ts-search-result-card {
    display: flex;
    align-items: stretch;
    gap: 14px;
    padding: 12px;
    border: 1px solid rgba(0,0,0,.09);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 3px 14px rgba(0,0,0,.04);
}

.ts-search-result-image {
    flex: 0 0 110px;
    width: 110px;
    height: 78px;
    overflow: hidden;
    border-radius: 10px;
    background: #f3f3f3;
}

.ts-search-result-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ts-search-result-body {
    min-width: 0;
    flex: 1;
}

.ts-search-result-body h3 {
    margin: 2px 0 7px;
    font-size: 18px;
    line-height: 1.5;
}

.ts-search-result-body h3 a {
    text-decoration: none;
}

.ts-search-result-body p {
    margin: 0;
    font-size: 14px;
    line-height: 1.8;
    opacity: .75;
}

.ts-search-result-status,
.ts-search-parent-topic {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
}

.ts-search-parent-topic {
    text-decoration: none;
    opacity: .78;
}

.ts-search-empty {
    text-align: center;
    padding: 52px 20px;
    border: 1px dashed rgba(0,0,0,.14);
    border-radius: 16px;
}

.ts-search-empty-icon {
    font-size: 42px;
    margin-bottom: 12px;
}

.ts-search-empty h2 {
    margin: 0 0 6px;
}

.ts-search-empty p {
    margin: 0;
    opacity: .7;
}

@media (max-width: 600px) {
    .ts-search-align-frame {
        width: min(100% - 20px, 760px);
        padding-top: 24px;
    }

    .ts-search-result-card {
        gap: 10px;
        padding: 10px;
    }

    .ts-search-result-image {
        flex-basis: 88px;
        width: 88px;
        height: 68px;
    }

    .ts-search-result-body h3 {
        font-size: 16px;
    }
}

/* =========================================================
 * TarinShow search - card appearance aligned with post pages
 * ========================================================= */
/* Topic search cards: keep the topic image on the right in RTL layouts. */
.ts-search-topic-card {
    flex-direction: row !important;
}


.ts-search-section {
    max-width: 333px;
    margin-inline: auto;
}

.ts-search-section > h2 {
    text-align: right;
    margin-bottom: 10px;
}

.ts-search-results {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ts-search-result-card {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
    min-height: 93px;
    padding: 6px;
    border: 0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 14px 28px rgba(8,10,12,.06);
    margin: 0;
    transition: transform .22s cubic-bezier(.2,.9,.3,1), box-shadow .22s;
}

.ts-search-result-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(8,10,12,.09);
}

.ts-search-result-image {
    flex: 0 0 85px;
    width: 85px;
    height: 81px;
    overflow: hidden;
    border-radius: 8px;
    background: #f0f0f0;
    box-shadow: 0 8px 20px rgba(0,0,0,.30);
}

.ts-search-result-image img {
    display: block;
    width: 85px;
    height: 81px;
    object-fit: cover;
}

.ts-search-result-body {
    min-width: 0;
    width: 12rem;
    flex: 1 1 auto;
    padding: 0 9px;
    box-sizing: border-box;
}

.ts-search-result-body h3 {
    margin: 0 0 8px;
    font-size: 18px;
    line-height: 1.2;
    border-bottom: inset;
    font-weight: 700;
}

.ts-search-result-body h3 a {
    color: #000 !important;
    text-decoration: none !important;
}

.ts-search-result-body h3 a:hover {
    color: #111 !important;
}

.ts-search-result-body p {
    margin: 0;
    color: #444;
    font-size: .5rem;
    line-height: 1.5;
    padding-bottom: 3px;
    opacity: 1;
}

.ts-search-parent-topic,
.ts-search-result-status {
    display: inline-block;
    margin-top: 5px;
    font-size: 7px;
    line-height: 1.4;
}

.ts-search-parent-topic {
    color: #666;
    text-decoration: none;
}

.ts-search-parent-topic:hover {
    color: #111;
}

@media (max-width: 600px) {
    .ts-search-align-frame {
        width: min(100% - 20px, 333px);
        padding-top: 24px;
    }

    .ts-search-section {
        width: 100%;
    }

    .ts-search-result-card {
        min-height: 93px;
    }
}


/* =========================================================
   TOPIC LIKE / HEART
========================================================= */
.ts-topic-like-row{display:flex;align-items:center;justify-content:flex-start;margin-top:7px;direction:rtl}
.ts-topic-like-btn{appearance:none;-webkit-appearance:none;border:0;background:transparent;padding:3px 4px;margin:0;display:inline-flex;align-items:center;gap:5px;cursor:pointer;color:#777;font:inherit;line-height:1;transition:color .18s ease,transform .18s ease}
.ts-topic-like-btn svg{width:20px;height:20px;display:block;flex:0 0 auto}
.ts-topic-like-btn .ts-topic-heart-filled{display:none !important}
.ts-topic-like-btn.liked{color:#e32636}
.ts-topic-like-btn.liked .ts-topic-heart-outline{display:none}
.ts-topic-like-btn.liked .ts-topic-heart-filled{display:block !important}
.ts-topic-like-count{font-size:13px;line-height:1;min-width:1ch;color:inherit}
.ts-topic-like-btn:hover{color:#e32636;transform:scale(1.04)}
.ts-topic-like-btn.ts-topic-like-loading{opacity:.55;pointer-events:none}

/* =========================================================
   1.3.0 — TarinShow visual system: navy + copper/gold
========================================================= */
:root {
    --ts-navy: #0b1426;
    --ts-navy-2: #111e35;
    --ts-copper: #d9822b;
    --ts-gold: #e3a047;
}

.ts-topic-card {
    border-color: #e4e8ee;
    box-shadow: 0 4px 14px rgba(11,20,38,.07);
}

.ts-topic-card .ts-card-body {
    display: flex;
    flex-direction: column;
    min-height: 132px;
    box-sizing: border-box;
}

.ts-topic-card .ts-title {
    font-size: 17px;
    line-height: 1.45;
    font-weight: 800;
    margin: 0 0 8px;
    padding-bottom: 7px;
    position: relative;
}

.ts-topic-card .ts-title::after {
    content: '';
    display: block;
    width: 34px;
    height: 2px;
    margin-top: 7px;
    background: var(--ts-copper);
    border-radius: 99px;
}

.ts-topic-card .ts-desc {
    font-size: 13px;
    line-height: 1.8;
    color: #687386;
}

.ts-topic-card .ts-meta {
    margin-top: auto;
    padding-top: 11px;
    border-top: 1px solid #edf0f4;
    color: #7b8492;
    font-size: 12px;
}

.ts-topic-card .ts-post-count {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-weight: 600;
}

/* Keep custom interaction controls independent from theme hover colors. */
.ts-topic-like-btn,
.ts-topic-like-btn:hover,
.ts-like-btn,
.ts-like-btn:hover,
.ts-rate-icon,
.ts-rate-icon:hover,
.ts-share-btn,
.ts-share-btn:hover,
.ts-topic-share-btn,
.ts-topic-share-btn:hover {
    background-color: transparent !important;
}

.ts-topic-like-btn:hover { color: inherit !important; }
.ts-like-btn:hover { color: #111 !important; }
.ts-rate-icon:hover { color: inherit !important; }
.ts-rate-icon:hover { transform: scale(1.08); }
.ts-topic-share-btn:hover { transform: scale(1.05); }

/* Theme-like controls use copper only for normal focus accents; liked remains red. */
.ts-topic-like-btn.liked { color: #d92f3a !important; }

@media (max-width:600px) {
    .ts-topic-card .ts-title { font-size: 16px; }
    .ts-topic-card .ts-desc { font-size: 12px; }
}


/* 1.3.1 — Unified page/list background and topic card hierarchy */
:root {
    --ts-navy: #142746;
    --ts-navy-2: #1c3558;
    --ts-copper: #c77a2b;
    --ts-gold: #e0a04a;
}

.ts-homepage,
.ts-home-topics-section,
.ts-topics-grid {
    background-color: #f3f6fa;
}

.ts-topic-card {
    background: #ffffff;
    border-color: #dfe5ed;
}

.ts-topic-card .ts-title a {
    color: #142746;
}

.ts-topic-card .ts-title::after {
    background: #c77a2b;
}


/* 1.3.2 — wide homepage topic cards */
.ts-homepage .ts-topics-grid .ts-topic-card {
    width: 100%;
    max-width: 100%;
}
.ts-homepage .ts-topic-card .ts-title {
    font-size: 19px;
    font-weight: 800;
    line-height: 1.5;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(199,122,43,.65);
}
.ts-homepage .ts-topic-card .ts-title a {
    color: #142746;
}
.ts-homepage .ts-topic-card .ts-desc {
    color: #66758a;
    font-size: 14px;
    line-height: 1.9;
}
.ts-homepage .ts-topic-card .ts-meta {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #edf0f4;
}
/* Keep custom controls independent from theme hover colors. */
.ts-topic-like-btn:hover,
.ts-topic-like-btn:focus,
.ts-subtopic-like-btn:hover,
.ts-subtopic-like-btn:focus,
.ts-rating-btn:hover,
.ts-rating-btn:focus {
    background: transparent !important;
    color: inherit !important;
}

/* 1.3.5 — topic card bottom actions + title separation */
.ts-homepage .ts-topic-card .ts-meta {
    margin-top: auto !important;
    padding: 8px 0 0 !important;
    border-top: 1px solid #edf0f4 !important;
    background: transparent !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
    color: #7b8492;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    direction: rtl;
}

.ts-homepage .ts-topic-card .ts-meta > .ts-topic-like-row {
    order: 1;
    margin: 0 !important;
    padding: 0;
    flex: 1 1 0;
    display: flex;
    justify-content: flex-start;
}

.ts-homepage .ts-topic-card .ts-meta > .ts-post-count,
.ts-homepage .ts-topic-card .ts-meta > span:not(.ts-topic-like-row) {
    order: 2;
    flex: 1 1 0;
    text-align: center;
}

.ts-homepage .ts-topic-card .ts-meta > .ts-report-button {
    order: 3;
    position: static !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline-flex !important;
    flex: 1 1 0;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 4px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #7b8492 !important;
    transform: none !important;
}

.ts-homepage .ts-topic-card .ts-report-button:hover,
.ts-homepage .ts-topic-card .ts-report-button:focus {
    background: transparent !important;
    color: #d62828 !important;
    transform: none !important;
}

.ts-homepage .ts-topic-card .ts-report-icon { font-size: 13px; line-height: 1; }
.ts-homepage .ts-topic-card .ts-report-text { font-size: 11px; line-height: 1.2; }

/* Keep the liked state red even while the button is focused after a click. */
.ts-homepage .ts-topic-like-btn.liked,
.ts-homepage .ts-topic-like-btn.liked:hover,
.ts-homepage .ts-topic-like-btn.liked:focus,
.ts-homepage .ts-topic-like-btn.liked:active {
    color: #d92f3a !important;
}

/* One separator only: the title gets a very light background instead. */
.ts-homepage .ts-topic-card .ts-title {
    margin: 0 0 10px !important;
    padding: 7px 9px 8px !important;
    border: 0 !important;
    border-radius: 6px;
    background: #f6f8fb;
}
.ts-homepage .ts-topic-card .ts-title::after { display: none !important; }

@media (max-width: 600px) {
    .ts-homepage .ts-topic-card .ts-meta { gap: 6px; }
    .ts-homepage .ts-topic-card .ts-report-text { font-size: 10px; }
}


/* 1.3.5 — topic card footer as a raised tray + expandable two-line description */
.ts-homepage .ts-topic-card {
    overflow: visible !important;
    margin-bottom: 18px;
}

.ts-homepage .ts-topic-card .ts-card-body {
    overflow: visible;
}

.ts-homepage .ts-topic-desc-wrap {
    position: relative;
}

.ts-homepage .ts-topic-card .ts-desc.ts-topic-desc-collapsed {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    max-height: 3.8em;
    margin-bottom: 0;
}

.ts-homepage .ts-topic-card .ts-desc.ts-topic-desc-expanded {
    display: block;
    max-height: none;
    overflow: visible;
}

.ts-homepage .ts-topic-desc-toggle {
    display: none;
    margin: 4px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #9a5d20;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.ts-homepage .ts-topic-desc-wrap.ts-has-more .ts-topic-desc-toggle {
    display: inline-block;
}

.ts-homepage .ts-topic-desc-toggle:hover,
.ts-homepage .ts-topic-desc-toggle:focus {
    background: transparent !important;
    color: #c77a2b !important;
    text-decoration: underline;
}

.ts-homepage .ts-topic-card .ts-meta {
    position: relative;
    z-index: 2;
    margin: 14px -6px -18px !important;
    padding: 9px 12px 10px !important;
    min-height: 34px;
    box-sizing: border-box;
    background: #ffffff !important;
    border: 1px solid #e5e9ef !important;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 3px 7px rgba(20,39,70,.08) !important;
}

.ts-homepage .ts-topic-card .ts-comment-count {
    white-space: nowrap;
}

.ts-homepage .ts-topic-card .ts-post-comments-separator {
    margin: 0 4px;
    color: #b8bec7;
}


/* 1.3.5 refinements */
.ts-homepage .ts-topic-card .ts-desc.ts-topic-desc-collapsed {
    line-height: 1.9 !important;
    max-height: 3.8em;
}
.ts-homepage .ts-topic-card .ts-meta {
    margin-left: -8px !important;
    margin-right: -8px !important;
    margin-bottom: -19px !important;
    border-radius: 0 0 9px 9px;
}


/* 1.3.6 — topic card footer sits visibly below the main card */
.ts-homepage .ts-topic-card {
    margin-bottom: 30px !important;
}

.ts-homepage .ts-topic-card .ts-meta {
    transform: translateY(10px);
    margin-top: 14px !important;
    margin-bottom: -29px !important;
    box-shadow: 0 4px 9px rgba(20,39,70,.10) !important;
}

/* Give the post/comment figures a little breathing room. */
.ts-homepage .ts-topic-card .ts-post-comments-separator {
    margin-left: 16px !important;
    margin-right: 16px !important;
}

/* Expanded descriptions must be allowed to grow with their content. */
.ts-homepage .ts-topic-card .ts-topic-desc-wrap {
    min-width: 0;
}
.ts-homepage .ts-topic-card .ts-desc.ts-topic-desc-expanded {
    display: block !important;
    -webkit-line-clamp: unset !important;
    line-clamp: unset !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    white-space: normal !important;
}

@media (max-width: 600px) {
    .ts-homepage .ts-topic-card .ts-post-comments-separator {
        margin-left: 11px !important;
        margin-right: 11px !important;
    }
}


/* Topic creator: subtle attribution at the bottom-left of the description. */
.ts-homepage .ts-topic-card .ts-topic-creator {
    width: 100%;
    text-align: left;
    direction: rtl;
    font-size: 10px;
    line-height: 1.5;
    color: #9aa2ad;
    margin-top: 3px;
    min-height: 15px;
}

/* Slightly more breathing room between post and comment counts. */
.ts-homepage .ts-topic-card .ts-post-comments-separator {
    margin: 0 7px;
}

@media (max-width: 600px) {
    .ts-homepage .ts-topic-card .ts-topic-creator {
        font-size: 9px;
    }
    .ts-homepage .ts-topic-card .ts-post-comments-separator {
        margin: 0 5px;
    }
}
