/* =====================================================================
   Nerkh Live - WordPress Plugin | https://nerkh.io
   Frontend widget: bar, table and block.
   ===================================================================== */

/* ---- Bar (sticky) ---- */
.nlw-bar {
    direction: rtl;
    margin: 0;
    padding: 0;
    border: none;
    font-family: 'IranYekan', 'IRANYekan', Tahoma, Arial, sans-serif;
}

.nlw-bar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7.5px 20px 7.5px 44px;
    margin: 0 auto;
    flex-direction: row-reverse;
}

.nlw-bar-scroll {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.nlw-bar-items {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    white-space: nowrap;
    flex: 1;
    justify-content: center;
    box-sizing: border-box;
}
.nlw-bar-items.nlw-marquee {
    flex: none;
    width: max-content;
    justify-content: flex-start;
    direction: rtl;
    gap: 0;
    user-select: none;
    -webkit-user-select: none;
    animation: nlw-marquee var(--nlw-duration, 30s) linear infinite;
    will-change: transform;
}
.nlw-bar-items.nlw-marquee:hover {
    animation-play-state: paused;
}
/* The track is right-anchored inside a `direction: rtl` box, so the shift
   must be POSITIVE: it drags the left-hand clones into the viewport and
   keeps the line full. A negative shift walked the whole row off-screen.

   The shift is a PERCENTAGE, not a pixel amount. The track always holds an
   EVEN number of identical copies, so 50% is exactly half the copies —
   i.e. a whole number of sets — which is what makes the loop seam-less.
   Because the percentage is re-resolved against the live width, any late
   reflow (web font, real prices, icon load) keeps the loop perfect without
   measuring anything again. A fixed px shift went stale the moment the
   content width changed and jumped on every cycle. */
@keyframes nlw-marquee {
    from { transform: translateX(0); }
    to { transform: translateX(50%); }
}
@media (prefers-reduced-motion: reduce) {
    .nlw-bar-items.nlw-marquee {
        animation: none;
    }
}

.nlw-bar-item {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 0 8px;
}

.nlw-bar-label-row {
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: flex-start;
    line-height: 1.2;
}
.nlw-bar-icon-wrap {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.nlw-bar-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    display: block;
    border-radius: 50%;
}
.nlw-bar-key {
    font-weight: 600;
    text-align: right;
}

.nlw-bar-price-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    direction: ltr;
    justify-content: flex-start;
    line-height: 1.15;
}

.nlw-bar-price {
    font-weight: 700;
}

.nlw-bar-suffix {
    font-size: 9px;
    font-weight: 300;
}

.nlw-bar-scroll {
    direction: rtl;
    overflow: hidden;
    min-width: 0;
}
.nlw-bar-scroll:has(.nlw-marquee) { overflow: hidden; }
.nlw-bar-sep {
    display: inline-block;
    width: 1px;
    height: 25px;
    min-width: 1px;
    margin: 0 10px;
    opacity: 0.5;
    flex-shrink: 0;
}

/* ---- Bar: calm API error state --------------------------------------
   One quiet line in place of the ticker:
     اتصال به سرویس قیمت برقرار نشده است: کد خطا: 460
   A self-contained dark glass pill keeps contrast on any bar colour,
   with a soft fade/slide and no layout shift. */
.nlw-bar-items.nlw-bar-items--error {
    width: auto !important;
    flex: 1 1 auto !important;
    justify-content: center;
}

.nlw-bar-error-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 1 auto;
    max-width: 100%;
    min-height: 26px;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 3px 10px;
    direction: rtl;
    color: #161616;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #000;
    border-radius: 999px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    backdrop-filter: blur(12px) saturate(140%);
    overflow: hidden;
    animation: nlw-error-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes nlw-error-in {
    from { opacity: 0; transform: translateY(5px) scale(0.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.nlw-bar-error-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    color: #dc2626;
}
.nlw-bar-error-icon svg {
    display: block;
    width: 16px;
    height: 16px;
}

@media (prefers-reduced-motion: no-preference) {
    .nlw-bar-error-icon {
        animation: nlw-error-breathe 3.2s ease-in-out infinite;
    }
}
@keyframes nlw-error-breathe {
    0%, 100% { opacity: 0.8; }
    50%      { opacity: 1; }
}

.nlw-bar-error-text {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.nlw-bar-error-label {
    min-width: 0;
    color: #161616;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nlw-bar-error-code {
    display: inline-block;
    flex: 0 0 auto;
    padding: 2px 7px;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.3;
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 999px;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .nlw-bar-error-state {
        gap: 6px;
        padding: 3px 8px;
    }
    .nlw-bar-error-text {
        font-size: 11px;
        gap: 4px;
    }
    .nlw-bar-error-code {
        font-size: 10px;
        padding: 2px 6px;
    }
}

@media (max-width: 380px) {
    .nlw-bar-error-icon {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nlw-bar-error-state { animation: none; }
}

/* ---- Table (in flow, modern dashboard card) ---- */
.nlw-table-mount {
    max-width: 100%;
    overflow-x: auto;
    /* No visible horizontal scrollbar under the table. Narrow phones can
       still swipe, but the bar itself is hidden. */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nlw-table-mount::-webkit-scrollbar {
    display: none;
}

.nlw-table-notice {
    direction: rtl;
    margin: 12px auto;
    padding: 12px 16px;
    max-width: 720px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #b91c1c;
    font-size: 13px;
    text-align: center;
}

.nlw-table {
    --nlw-tb-border: #e2e8f0;
    box-sizing: border-box;
    direction: rtl;
    margin: 12px auto;
    padding: 0;
    width: 100%;
    max-width: 760px;
    min-width: 620px;
    background: #ffffff;
    border: 1px solid var(--nlw-tb-border);
    border-radius: 10px;
    box-shadow: none;
    font-family: 'IranYekan', 'IRANYekan', Tahoma, Arial, sans-serif;
    font-size: 14px;
    overflow: hidden;
}

.nlw-table-el {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    table-layout: fixed;
}

.nlw-table-th {
    box-sizing: border-box;
    text-align: center;
    padding: 11px 8px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    color: #ffffff;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-inline-end: 1px solid rgba(255, 255, 255, 0.14);
    vertical-align: middle;
}
.nlw-table-th:first-child {
    text-align: right;
    padding-inline-start: 14px;
}
.nlw-table-th:last-child {
    border-inline-end: none;
}

/* Fixed widths keep header and body perfectly aligned; the change column
   carries much less data, so it gets the smallest share. */
/* Proportional widths: at the 780px max width these equal exactly
   225 / 161 / 149 / 149 / 96px, but they also scale down on narrow
   containers instead of clipping the last (change) column. */
.nlw-table-th:nth-child(1) { width: 28.29%; }
.nlw-table-th:nth-child(2) { width: 19.87%; }
.nlw-table-th:nth-child(3) { width: 19.6%; }
.nlw-table-th:nth-child(4) { width: 19.6%; }
.nlw-table-th:nth-child(5) { width: 12.63%; }

.nlw-table-el tbody tr {
    border-bottom: 1px solid var(--nlw-tb-border);
}
.nlw-table-el tbody tr:last-child {
    border-bottom: none;
}

.nlw-table-el tbody td {
    box-sizing: border-box;
    padding: 13px 8px;
    font-size: 14px;
    line-height: 1.25;
    text-align: center;
    vertical-align: middle;
    border-inline-end: 1px solid var(--nlw-tb-border);
}
.nlw-table-el tbody td:first-child {
    text-align: right;
    padding-inline-start: 14px;
    background: rgba(15, 23, 42, 0.035);
}
.nlw-table-el tbody td:last-child {
    border-inline-end: none;
}

/* Subtle zebra + hover highlight, translucent so custom table backgrounds
   keep working. */
.nlw-table-el tbody tr:nth-child(even) td {
    background: rgba(15, 23, 42, 0.025);
}
.nlw-table-el tbody tr:hover td {
    background: rgba(79, 70, 229, 0.07);
}

.nlw-table-label {
    color: #1e293b;
    font-weight: 600;
}
.nlw-table-label-inner {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}
.nlw-table-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border-radius: 50%;
    object-fit: contain;
}
.nlw-table-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nlw-table-price {
    direction: ltr;
    display: inline-block;
    font-weight: 700;
}
.nlw-table-min,
.nlw-table-max {
    direction: ltr;
    display: inline-block;
    font-size: 13px;
    color: #64748b;
}
.nlw-table-change {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.nlw-table-heart {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #1e293b;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.nlw-table-heart:hover,
.nlw-table-heart:focus-visible {
    color: #0f172a;
    text-decoration: none;
}

.nlw-table-heart svg {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.nlw-table-date {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--nlw-tb-border);
    background: rgba(15, 23, 42, 0.03);
    font-size: 11px;
    color: #64748b;
    min-height: 34px;
}

.nlw-table-update-btn {
    font-family: inherit;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    background: #1e293b;
    border: 1px solid #0f172a;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.nlw-table-update-btn:hover,
.nlw-table-update-btn:focus-visible {
    background: #334155;
    border-color: #334155;
    outline: none;
}

@media screen and (max-width: 700px) {
    .nlw-table {
        min-width: 560px;
    }
    .nlw-table-th {
        padding: 9px 6px;
        font-size: 11px;
    }
    .nlw-table-el tbody td {
        padding: 11px 6px;
        font-size: 13px;
    }
}
