/* ============================================================
   TechMag — استایل امکانات جدید (حالت شب، اینستاگرام، خبرنامه،
   فهرست مطالب، نقد محصول، مقایسه، ابزارها، پرسش‌وپاسخ، ...)
   ============================================================ */

/* ---------------- Dark mode ---------------- */
:root[data-theme="dark"]{
	--color-bg:#0f1115;
	--color-surface:#171a21;
	--color-border:#2a2e37;
	--color-text:#eef1f5;
	--color-text-light:#9aa3b2;
}
:root[data-theme="dark"] img:not(.tm-ig-av img){filter:brightness(.92)}
:root[data-theme="dark"] .tm-header,
:root[data-theme="dark"] .tm-footer{background:var(--color-surface);border-color:var(--color-border)}
:root[data-theme="dark"] .tm-card,
:root[data-theme="dark"] .tm-row-card,
:root[data-theme="dark"] .tm-widget,
:root[data-theme="dark"] .tm-toc,
:root[data-theme="dark"] .tm-review,
:root[data-theme="dark"] .tm-series,
:root[data-theme="dark"] .tm-cmp,
:root[data-theme="dark"] .tm-tool,
:root[data-theme="dark"] .tm-qa-form,
:root[data-theme="dark"] .tm-nl,
:root[data-theme="dark"] .tm-modal-box{background:var(--color-surface);border-color:var(--color-border)}

.tm-theme-toggle{position:relative}
.tm-theme-ic{display:none}
:root:not([data-theme="dark"]) .tm-theme-ic--sun{display:flex}
:root[data-theme="dark"] .tm-theme-ic--moon{display:flex}
.tm-theme-ic svg{width:20px;height:20px}

/* ---------------- Ticker ---------------- */
.tm-ticker{background:var(--color-surface);border-bottom:1px solid var(--color-border);overflow:hidden}
.tm-ticker ul{display:flex;gap:26px;overflow-x:auto;padding:8px 0;scrollbar-width:none}
.tm-ticker ul::-webkit-scrollbar{display:none}
.tm-ticker li{display:flex;align-items:center;gap:6px;flex:0 0 auto;font-size:12.5px;white-space:nowrap}
.tm-tk-name{color:var(--color-text-light)}
.tm-tk-price{font-weight:700}
.tm-tk-ch{display:inline-flex;align-items:center;gap:2px}
.tm-tk-ch svg{width:12px;height:12px}
.tm-tk-ch.up{color:#16a34a}
.tm-tk-ch.down{color:#dc2626}

/* ---------------- Hot topics ---------------- */
.tm-hot-topics{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:14px 16px;margin:14px auto}
.tm-hot-label{display:inline-flex;align-items:center;gap:6px;font-weight:700;color:var(--color-accent);flex:0 0 auto}
.tm-hot-label svg{width:16px;height:16px}
.tm-hot-list{display:flex;gap:8px;flex-wrap:wrap}
.tm-hot-list a{background:var(--color-surface);border:1px solid var(--color-border);border-radius:20px;padding:5px 13px;font-size:12.5px}
.tm-hot-list a:hover{border-color:var(--color-primary);color:var(--color-primary)}

/* ---------------- Mega menu ---------------- */
.tm-mega-panel{position:absolute;inset-inline:0;top:0;background:var(--color-bg);border-bottom:1px solid var(--color-border);box-shadow:0 12px 24px rgba(0,0,0,.08);z-index:60;padding:18px 0}
.tm-mega-panel[hidden]{display:none}
.tm-mega-panel .container{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}
.tm-mega-item{display:flex;gap:10px;align-items:center}
.tm-mega-item img{width:64px;height:48px;object-fit:cover;border-radius:8px;flex:0 0 auto}
.tm-mega-item h5{font-size:13px;line-height:1.6}
.tm-mega-more{grid-column:1/-1;text-align:left}

/* ---------------- Search results dropdown ---------------- */
.tm-search-results{max-width:640px;margin:8px auto 0;background:var(--color-bg);border:1px solid var(--color-border);border-radius:12px;overflow:hidden}
.tm-search-results[hidden]{display:none}
.tm-sr-item{display:flex;gap:10px;align-items:center;padding:9px 12px;border-bottom:1px solid var(--color-border)}
.tm-sr-item img{width:48px;height:36px;object-fit:cover;border-radius:6px;flex:0 0 auto}
.tm-sr-cat{color:var(--color-text-light);font-size:11px}
.tm-sr-more{display:block;text-align:center;padding:10px;color:var(--color-primary);font-weight:600;font-size:13px}
.tm-sr-empty,.tm-sr-loading{padding:14px;text-align:center;color:var(--color-text-light);font-size:13px}

/* ---------------- Reading progress ---------------- */
.tm-progress{position:sticky;top:0;height:3px;background:transparent;z-index:70}
.tm-progress span{display:block;height:100%;width:0;background:var(--color-primary);transition:width .1s linear}

/* ---------------- TOC ---------------- */
.tm-toc{background:var(--color-surface);border:1px solid var(--color-border);border-radius:12px;padding:14px 16px;margin:0 0 22px}
.tm-toc-head{display:flex;align-items:center;gap:8px;width:100%;font-weight:700}
.tm-toc-head svg{width:18px;height:18px}
.tm-toc-arrow{margin-inline-start:auto;transition:transform .2s}
.tm-toc.is-collapsed .tm-toc-arrow{transform:rotate(-90deg)}
.tm-toc-list{margin-top:10px;display:flex;flex-direction:column;gap:6px}
.tm-toc.is-collapsed .tm-toc-list{display:none}
.tm-toc-list li a{font-size:13.5px;color:var(--color-text-light)}
.tm-toc-list li.lvl-3{padding-inline-start:16px}
.tm-toc-list li a.is-active{color:var(--color-primary);font-weight:700}

/* ---------------- Reader mode ---------------- */
.tm-reader-toggle{display:inline-flex;align-items:center;gap:6px;margin-top:10px;font-size:12.5px;color:var(--color-text-light);border:1px solid var(--color-border);border-radius:20px;padding:5px 12px}
.tm-reader-toggle svg{width:15px;height:15px}
body.tm-reader-mode .tm-single-content{font-size:19px;line-height:2.1;max-width:680px;margin:0 auto}
body.tm-reader-mode .tm-sidebar,
body.tm-reader-mode .tm-related,
body.tm-reader-mode .tm-ig,
body.tm-reader-mode .tm-nl{display:none}

/* ---------------- Post tools additions ---------------- */
.tm-tool[aria-pressed="true"]{color:var(--color-accent)}
.tm-post-engage{display:flex;align-items:center;gap:12px;margin:22px 0}
.tm-like-btn,.tm-report-btn{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--color-border);border-radius:20px;padding:8px 16px;font-size:13px}
.tm-like-btn svg,.tm-report-btn svg{width:16px;height:16px}
.tm-like-btn[aria-pressed="true"]{color:#fff;background:var(--color-accent);border-color:var(--color-accent)}
.tm-like-btn.is-anim svg{animation:tm-pop .35s ease}
@keyframes tm-pop{0%{transform:scale(1)}40%{transform:scale(1.35)}100%{transform:scale(1)}}
.tm-author-more{display:inline-flex;align-items:center;gap:4px;font-size:12.5px;color:var(--color-primary);margin-top:6px}

/* ---------------- Series box ---------------- */
.tm-series{background:var(--color-surface);border:1px solid var(--color-border);border-radius:12px;padding:14px 16px;margin:18px 0}
.tm-series-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.tm-series-badge{background:var(--color-primary);color:#fff;border-radius:20px;padding:3px 12px;font-size:12px;font-weight:700}
.tm-series-name{font-weight:700}
.tm-series-list{margin-top:8px}
.tm-series-list summary{cursor:pointer;font-size:13px;color:var(--color-text-light);display:flex;align-items:center;gap:6px}
.tm-series-list summary svg{width:14px;height:14px}
.tm-series-list ol{margin:8px 0 0 0;padding-inline-start:20px}
.tm-series-list li{padding:4px 0;font-size:13.5px}
.tm-series-list li.is-current{color:var(--color-primary);font-weight:700}
.tm-series-nav{display:flex;justify-content:space-between;margin-top:10px;font-size:13px}
.tm-series-nav a{display:inline-flex;align-items:center;gap:4px}

/* ---------------- Review box ---------------- */
.tm-review{display:flex;gap:20px;background:var(--color-surface);border:1px solid var(--color-border);border-radius:14px;padding:20px;margin:24px 0}
.tm-review-ring{display:flex;flex-direction:column;align-items:center;justify-content:center;width:92px;height:92px;border-radius:50%;background:conic-gradient(var(--color-primary) calc(var(--p)*1%),var(--color-border) 0);flex:0 0 auto}
.tm-review-ring b{background:var(--color-bg);width:74px;height:74px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:22px}
.tm-review-ring small{display:none}
.tm-review-main h3{margin-bottom:6px}
.tm-review-price{color:var(--color-text-light);font-size:13px;margin-bottom:10px}
.tm-review-lists{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:10px}
.tm-review-lists h4{font-size:13px;margin-bottom:6px}
.tm-pros li,.tm-cons li{display:flex;align-items:flex-start;gap:6px;font-size:13.5px;padding:3px 0}
.tm-pros svg{color:#16a34a;width:16px;height:16px;flex:0 0 auto;margin-top:2px}
.tm-cons svg{color:#dc2626;width:16px;height:16px;flex:0 0 auto;margin-top:2px}
.tm-review-verdict{font-size:14px;border-top:1px dashed var(--color-border);padding-top:10px}

/* ---------------- HowTo / FAQ ---------------- */
.tm-howto,.tm-faq{margin:26px 0}
.tm-howto h3,.tm-faq h3{margin-bottom:10px}
.tm-howto ol{padding-inline-start:22px;display:flex;flex-direction:column;gap:12px}
.tm-howto li strong{display:block;margin-bottom:2px}
.tm-faq details{border:1px solid var(--color-border);border-radius:10px;padding:12px 14px;margin-bottom:8px}
.tm-faq summary{cursor:pointer;display:flex;justify-content:space-between;align-items:center;font-weight:600;list-style:none}
.tm-faq summary::-webkit-details-marker{display:none}
.tm-faq summary svg{width:16px;height:16px;transition:transform .2s}
.tm-faq details[open] summary svg{transform:rotate(180deg)}
.tm-faq p{margin-top:8px;color:var(--color-text-light)}

/* ---------------- Comments extras ---------------- */
.comment-main{flex:1}
.comment-meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:4px}
.tm-author-badge{background:var(--color-primary);color:#fff;border-radius:10px;padding:1px 8px;font-size:10.5px}
.comment-date{color:var(--color-text-light);font-size:11.5px}
.comment-actions{display:flex;align-items:center;gap:14px;margin-top:6px;font-size:12.5px}
.tm-comment-like{display:inline-flex;align-items:center;gap:4px;color:var(--color-text-light)}
.tm-comment-like svg{width:14px;height:14px}
.tm-comment-like[aria-pressed="true"]{color:var(--color-accent)}

/* ---------------- Instagram CTA ---------------- */
.tm-ig{display:flex;align-items:center;gap:14px;background:linear-gradient(120deg,#4f5bd5 0%,#962fbf 30%,#d62976 55%,#fa7e1e 80%,#feda75 100%);color:#fff;border-radius:16px;padding:18px}
.tm-ig-av{flex:0 0 60px;width:60px;height:60px;border-radius:50%;overflow:hidden;border:2px solid rgba(255,255,255,.8);display:flex;align-items:center;justify-content:center;background:rgba(255,255,255,.15)}
.tm-ig-av img{width:100%;height:100%;object-fit:cover}
.tm-ig-av--icon svg{width:28px;height:28px}
.tm-ig-body{flex:1;min-width:0}
.tm-ig-title{display:block;font-weight:800;font-size:16px;margin-bottom:2px}
.tm-ig-text{font-size:13px;opacity:.92;margin-bottom:6px}
.tm-ig-meta{font-size:11.5px;opacity:.85}
.tm-ig-btn{flex:0 0 auto;display:inline-flex;align-items:center;gap:6px;background:#fff;color:#c13584;font-weight:700;border-radius:24px;padding:10px 18px;font-size:13.5px;white-space:nowrap}
.tm-ig-btn svg{width:17px;height:17px}
.tm-ig--box{margin:26px 0}
.tm-ig--widget{padding:16px;border-radius:14px}
.tm-ig-band .container{padding:26px 16px}
.tm-ig--banner{max-width:760px;margin:0 auto}
.tm-ig--popup{position:fixed;bottom:18px;inset-inline-end:18px;max-width:340px;z-index:80;box-shadow:0 14px 32px rgba(0,0,0,.25);animation:tm-ig-in .4s ease}
.tm-ig--popup[hidden]{display:none}
@keyframes tm-ig-in{from{transform:translateY(16px);opacity:0}to{transform:translateY(0);opacity:1}}
.tm-ig-close{position:absolute;top:8px;inset-inline-end:8px;width:24px;height:24px;border-radius:50%;background:rgba(0,0,0,.25);display:flex;align-items:center;justify-content:center}
.tm-ig-close svg{width:13px;height:13px;color:#fff}
@media (max-width:640px){.tm-ig--popup{inset-inline:12px;bottom:12px;max-width:none}}

/* ---------------- Newsletter ---------------- */
.tm-nl{display:flex;align-items:flex-start;gap:14px;background:var(--color-surface);border:1px solid var(--color-border);border-radius:14px;padding:18px}
.tm-nl-icon{flex:0 0 auto;width:44px;height:44px;border-radius:50%;background:var(--color-primary);color:#fff;display:flex;align-items:center;justify-content:center}
.tm-nl-icon svg{width:20px;height:20px}
.tm-nl-title{display:block;font-size:15px;margin-bottom:2px}
.tm-nl-text{font-size:13px;color:var(--color-text-light);margin-bottom:10px}
.tm-nl-row{display:flex;gap:8px}
.tm-nl-row input{flex:1;border:1px solid var(--color-border);border-radius:10px;padding:10px 14px;background:var(--color-bg);color:var(--color-text)}
.tm-nl--band{max-width:760px;margin:0 auto;flex-direction:column;text-align:center;align-items:center}
.tm-nl--band .tm-nl-row{width:100%;max-width:420px}
.tm-hp{position:absolute;inset-inline-start:0;top:0;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);opacity:0;pointer-events:none;white-space:nowrap}
.tm-form-msg{margin-top:8px;font-size:12.5px;min-height:1em}
.tm-form-msg.is-ok{color:#16a34a}
.tm-form-msg.is-err{color:#dc2626}

/* ---------------- Modals (report / newsletter popup) ---------------- */
.tm-modal{position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:90;display:flex;align-items:center;justify-content:center;padding:16px}
.tm-modal[hidden]{display:none}
.tm-modal-box{position:relative;background:var(--color-bg);border-radius:16px;padding:26px;max-width:440px;width:100%;max-height:88vh;overflow:auto}
.tm-modal-close{position:absolute;top:12px;inset-inline-end:12px;width:30px;height:30px;border-radius:50%;background:var(--color-surface);display:flex;align-items:center;justify-content:center}
.tm-modal-close svg{width:15px;height:15px}
.tm-modal-box form label{display:block;font-size:13px;font-weight:600;margin:10px 0 4px}
.tm-modal-box input,.tm-modal-box textarea,.tm-modal-box select{width:100%;border:1px solid var(--color-border);border-radius:8px;padding:9px 12px;background:var(--color-bg);color:var(--color-text)}
.tm-modal-box .tm-btn{margin-top:12px}

/* ---------------- Compare table ---------------- */
.tm-cmp{margin:20px 0}
.tm-cmp-bar{display:flex;justify-content:flex-end;margin-bottom:8px;font-size:13px}
.tm-cmp-diff{display:inline-flex;align-items:center;gap:6px}
.tm-cmp-scroll{overflow-x:auto;border:1px solid var(--color-border);border-radius:12px}
.tm-cmp-table{width:100%;border-collapse:collapse;min-width:520px}
.tm-cmp-table th,.tm-cmp-table td{padding:10px 14px;border-bottom:1px solid var(--color-border);text-align:center;font-size:13.5px}
.tm-cmp-table th[scope="row"]{text-align:right;color:var(--color-text-light);white-space:nowrap}
.tm-cmp-corner{background:var(--color-surface)}
.tm-cmp-prod{background:var(--color-surface);min-width:160px}
.tm-cmp-prod img{width:80px;height:80px;object-fit:contain;margin:0 auto 8px}
.tm-cmp-price{display:block;color:var(--color-primary);font-weight:700;margin:4px 0 8px}
.tm-cmp-group th{background:var(--color-surface);text-align:right!important;color:var(--color-primary);font-size:12.5px}
.tm-cmp.is-diff-only .is-same{display:none}

/* ---------------- Q&A ---------------- */
.tm-qa-form{background:var(--color-surface);border:1px solid var(--color-border);border-radius:14px;padding:18px;margin-bottom:22px}
.tm-qa-form h3{margin-bottom:10px}
.tm-field-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.tm-qa-mini{display:flex;flex-direction:column;gap:8px}
.tm-qa-mini a{display:flex;align-items:center;gap:8px;font-size:13.5px}
.tm-qa-mini svg{width:16px;height:16px;color:var(--color-primary);flex:0 0 auto}
.tm-qa-list{display:flex;flex-direction:column;gap:2px}
.tm-qa-list li{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 0;border-bottom:1px solid var(--color-border)}
.tm-qa-list a{display:flex;align-items:center;gap:8px}
.tm-qa-list svg{width:16px;height:16px;color:var(--color-primary)}
.tm-qa-answered{color:#16a34a;font-size:11.5px}
.tm-qa-pending{color:#c99616;font-size:11.5px}
.tm-qa-answer{background:var(--color-surface);border-radius:12px;padding:16px;margin-top:16px}
.tm-qa-answer-label{display:flex;align-items:center;gap:6px;color:var(--color-primary);margin-bottom:8px}
.tm-qa-answer-label svg{width:16px;height:16px}
.tm-qa-waiting{color:var(--color-text-light);margin-top:14px}

/* ---------------- Homepage extras ---------------- */
.tm-feat-split{display:grid;grid-template-columns:1.4fr 1fr;gap:20px}
.tm-feat-main img{border-radius:12px;margin-bottom:10px}
.tm-feat-main h3{font-size:19px;margin-bottom:6px}
.tm-feat-main p{color:var(--color-text-light);font-size:13.5px}
.tm-feat-list{display:flex;flex-direction:column;gap:12px}
.tm-feat-row{display:flex;gap:10px;align-items:center}
.tm-feat-row-thumb{flex:0 0 76px;width:76px;height:56px;border-radius:8px;overflow:hidden}
.tm-feat-row-thumb img{width:100%;height:100%;object-fit:cover}
.tm-feat-row h4{font-size:13.5px;line-height:1.6}
.tm-mini-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}
.tm-mini-card2 .tm-mini-thumb{position:relative;display:block;border-radius:10px;overflow:hidden;aspect-ratio:4/3}
.tm-mini-play{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.25)}
.tm-mini-play svg{width:32px;height:32px;color:#fff}
.tm-mini-badge{position:absolute;top:8px;inset-inline-start:8px;background:rgba(0,0,0,.6);color:#fff;font-size:10.5px;border-radius:6px;padding:2px 8px}
.tm-mini-card2 h4{font-size:13px;margin-top:6px}
.tm-tools-promo .tm-tools-chips{display:flex;flex-wrap:wrap;gap:10px}
.tm-tools-chips a{background:var(--color-surface);border:1px solid var(--color-border);border-radius:12px;padding:12px 16px;font-size:13px;font-weight:600}
.tm-tools-chips a:hover{border-color:var(--color-primary);color:var(--color-primary)}
.tm-more{font-size:12.5px;color:var(--color-primary);display:inline-flex;align-items:center;gap:4px}
.tm-more svg{width:14px;height:14px}
.tm-footer-extra{margin-top:8px}

/* ---------------- Popular widget tabs ---------------- */
.tm-pop-tabbtns{display:flex;gap:4px;background:var(--color-surface);border-radius:20px;padding:3px;margin-bottom:10px}
.tm-pop-tabbtns button{flex:1;font-size:11.5px;padding:6px 4px;border-radius:16px}
.tm-pop-tabbtns button.is-active{background:var(--color-primary);color:#fff}
.tm-pop{display:flex;flex-direction:column;gap:10px}
.tm-pop-item{display:flex;align-items:center;gap:10px}
.tm-pop-num{flex:0 0 22px;font-weight:800;color:var(--color-primary);font-size:15px}
.tm-pop-link{display:flex;align-items:center;gap:8px;flex:1;min-width:0}
.tm-pop-thumb{flex:0 0 52px;width:52px;height:40px;border-radius:6px;overflow:hidden}
.tm-pop-thumb img{width:100%;height:100%;object-fit:cover}
.tm-pop-text strong{display:block;font-size:13px;line-height:1.6}
.tm-pop-text small{display:flex;align-items:center;gap:3px;color:var(--color-text-light);font-size:11px;margin-top:2px}
.tm-pop-text small svg{width:12px;height:12px}

/* ---------------- Offline page ---------------- */
.tm-offline{text-align:center;padding:80px 16px}
.tm-offline svg{width:60px;height:60px;color:var(--color-text-light);margin-bottom:16px}

/* ---------------- Buttons ---------------- */
.tm-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;background:var(--color-primary);color:#fff;border-radius:10px;padding:10px 20px;font-size:13.5px;font-weight:700}
.tm-btn-ghost{background:transparent;color:var(--color-primary);border:1px solid var(--color-primary)}

/* ---------------- Toast (like js/main.js) ---------------- */
.tm-toast{position:fixed;bottom:22px;left:50%;transform:translateX(-50%) translateY(20px);background:#111;color:#fff;padding:10px 20px;border-radius:24px;font-size:13px;opacity:0;transition:.25s;z-index:99;pointer-events:none}
.tm-toast.is-visible{opacity:1;transform:translateX(-50%) translateY(0)}

/* ---------------- Responsive ---------------- */
@media (max-width:960px){
	.tm-mega-panel .container{grid-template-columns:repeat(2,1fr)}
	.tm-review{flex-direction:column;align-items:flex-start}
	.tm-feat-split{grid-template-columns:1fr}
	.tm-mini-grid{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:640px){
	.tm-ig{flex-direction:column;text-align:center}
	.tm-nl{flex-direction:column;align-items:center;text-align:center}
	.tm-nl-row{flex-direction:column;width:100%}
	.tm-review-lists{grid-template-columns:1fr}
	.tm-field-row{grid-template-columns:1fr}
	.tm-mini-grid{grid-template-columns:1fr 1fr}
}
