/* Ürün sayfası "Fiyat Değişimi" kartı + detay grafiği (assets/js/price-trend.js). Vanilla CSS + BEM. */

.pf-trend-card {
    --pf-trend-low: var(--pf-success, #047857);
    --pf-trend-line: var(--pf-accent, #0f4c81);
    margin-top: 10px;
    padding: 10px 12px 0;
    background: var(--pf-bg-card, #fff);
    border: 1px solid var(--pf-border, #e2e8f0);
    border-radius: 12px;
    text-align: left;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    /* .pf-price-section ortalanmış flex sütun: kart içeriğine göre daralmasın, buy box genişliğinde dursun */
    align-self: stretch;
    width: 100%;
    box-sizing: border-box;
}

.pf-trend-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.pf-trend-card__head .pf-trend-tabs {
    margin-left: auto;
}

.pf-trend-card__title {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--pf-text-primary, #0f172a);
    white-space: nowrap;
}

/* Dönem sekmeleri (kart + detay ortak) */
.pf-trend-tabs {
    display: inline-flex;
    gap: 1px;
    padding: 2px;
    background: var(--pf-bg-hover, #f1f5f9);
    border-radius: 8px;
}

.pf-trend-tabs[hidden] {
    display: none;
}

.pf-trend-tabs__btn {
    min-width: 32px;
    min-height: 28px;
    padding: 0 6px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--pf-text-muted, #64748b);
    font: 600 12px/1 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.pf-trend-tabs--detail .pf-trend-tabs__btn {
    min-width: 38px;
    min-height: 32px;
    font-size: 12.5px;
}

.pf-trend-tabs__btn:hover {
    color: var(--pf-text-primary, #0f172a);
}

.pf-trend-tabs__btn[aria-pressed="true"] {
    background: var(--pf-bg-card, #fff);
    color: var(--pf-trend-line, #0f4c81);
    font-weight: 800;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.pf-trend-tabs__btn:focus-visible,
.pf-trend-card__body:focus-visible,
.pf-trend-card__more:focus-visible,
.pf-trend-card__alarm:focus-visible,
.pf-trend-chart:focus-visible {
    outline: 2px solid var(--pf-trend-line, #0f4c81);
    outline-offset: 2px;
}

/* Gövde: mini grafik + tek satır özet */
.pf-trend-card__body {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
    margin-top: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
    color: inherit;
    cursor: pointer;
    border-radius: 8px;
}

.pf-trend-card__spark {
    display: block;
    width: 100%;
    height: 76px;
}

@media (min-width: 768px) {
    .pf-trend-card__spark {
        height: 88px;
    }
}

.pf-trend-card__spark svg {
    display: block;
    overflow: visible;
}

.pf-trend-card__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.pf-trend-card__stat {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pf-trend-card__stat + .pf-trend-card__stat {
    padding-left: 8px;
    border-left: 1px solid var(--pf-border, #e2e8f0);
}

.pf-trend-card__stat-label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--pf-text-muted, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-trend-card__stat-date {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.pf-trend-card__stat-val {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--pf-text-primary, #0f172a);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-trend-card__stat--low .pf-trend-card__stat-val {
    color: var(--pf-trend-low);
}

.pf-trend-spark__line,
.pf-trend-chart__line {
    fill: none;
    stroke: var(--pf-trend-line, #0f4c81);
    stroke-width: 2.25;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.pf-trend-spark-stop-top,
.pf-trend-chart-stop-top {
    stop-color: var(--pf-trend-line, #0f4c81);
    stop-opacity: 0.16;
}

.pf-trend-spark-stop-bottom,
.pf-trend-chart-stop-bottom {
    stop-color: var(--pf-trend-line, #0f4c81);
    stop-opacity: 0;
}

.pf-trend-spark__low-line,
.pf-trend-chart__low-line {
    stroke: var(--pf-trend-low);
    stroke-width: 1.25;
    stroke-dasharray: 5 5;
    opacity: 0.75;
}

.pf-trend-spark__low-halo,
.pf-trend-chart__low-halo {
    fill: var(--pf-trend-low);
    opacity: 0.2;
}

.pf-trend-spark__low-dot,
.pf-trend-chart__low-dot {
    fill: var(--pf-trend-low);
    stroke: var(--pf-bg-card, #fff);
    stroke-width: 1.5;
}

.pf-trend-spark__end-dot,
.pf-trend-chart__end-dot {
    fill: var(--pf-trend-line, #0f4c81);
    stroke: var(--pf-bg-card, #fff);
    stroke-width: 1.5;
}

/* Alt satır: fiyat yorumu + Detay + Alarm */
.pf-trend-card__foot {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px -12px 0;
    padding: 6px 8px 6px 12px;
    border-top: 1px solid var(--pf-border, #e2e8f0);
}

.pf-trend-card__verdict {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--pf-text-secondary, #475569);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-trend-card__verdict:empty {
    visibility: hidden;
}

.pf-trend-card__verdict--best,
.pf-trend-card__verdict--good {
    color: var(--pf-success, #047857);
}

.pf-trend-card__verdict--high {
    color: #b45309;
}

.pf-trend-card__more {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 32px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--pf-trend-line, #0f4c81);
    font: 700 13px/1 'Inter', sans-serif;
    cursor: pointer;
}

.pf-trend-card__more:hover {
    background: var(--pf-bg-hover, #f1f5f9);
}

.pf-trend-card__more .bi {
    font-size: 11px;
}

.pf-trend-down {
    color: var(--pf-success, #047857);
}

.pf-trend-up {
    color: var(--pf-danger, #dc2626);
}

.pf-trend-card__alarm {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--pf-border, #e2e8f0);
    border-radius: 50%;
    background: var(--pf-bg-card, #fff);
    color: var(--pf-text-secondary, #475569);
    font-size: 15px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.pf-trend-card__alarm:hover {
    border-color: var(--pf-trend-line, #0f4c81);
    color: var(--pf-trend-line, #0f4c81);
}

.pf-trend-card__alarm.is-active {
    color: var(--pf-success, #047857);
    border-color: currentColor;
}

/* Mobilde yalnız zil simgesi; masaüstünde yanında "Alarm Kur" yazısı */
.pf-trend-card__alarm-text {
    display: none;
}

@media (min-width: 768px) {
    .pf-trend-card__alarm {
        width: auto;
        gap: 6px;
        padding: 0 14px;
        border-radius: 999px;
    }
    .pf-trend-card__alarm-text {
        display: inline;
        font: 700 13px/1 'Inter', sans-serif;
        white-space: nowrap;
    }
}

/* ---- Detay grafiği ---- */
.pf-trend-detail {
    --pf-trend-low: var(--pf-success, #047857);
    --pf-trend-line: var(--pf-accent, #0f4c81);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.pf-trend-detail__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.pf-trend-detail__read {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    min-height: 62px;
}

.pf-trend-detail__read-date {
    font-size: 12.5px;
    color: var(--pf-text-muted, #64748b);
}

.pf-trend-detail__read-price {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: var(--pf-text-primary, #0f172a);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.pf-trend-detail__read-meta {
    font-size: 12px;
    color: var(--pf-text-secondary, #475569);
}

.pf-trend-chart {
    position: relative;
    height: 240px;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    cursor: crosshair;
    border-radius: 8px;
}

.pf-trend-detail--sheet .pf-trend-chart {
    height: 280px;
    touch-action: none;
}

.pf-trend-chart__svg {
    display: block;
}

.pf-trend-chart__grid {
    stroke: var(--pf-border, #e2e8f0);
    stroke-width: 1;
    stroke-dasharray: 3 4;
}

.pf-trend-chart__ylabel,
.pf-trend-chart__xlabel {
    fill: var(--pf-text-muted, #64748b);
    font: 500 11px 'Inter', sans-serif;
    font-variant-numeric: tabular-nums;
}

.pf-trend-chart__high-dot {
    fill: var(--pf-bg-card, #fff);
    stroke: var(--pf-text-muted, #64748b);
    stroke-width: 1.5;
}

.pf-trend-chart__cross {
    stroke: var(--pf-text-secondary, #475569);
    stroke-width: 1;
    stroke-dasharray: 3 3;
}

.pf-trend-chart__cursor {
    fill: var(--pf-trend-line, #0f4c81);
    stroke: var(--pf-bg-card, #fff);
    stroke-width: 2.5;
}

.pf-trend-chart__bubble {
    position: absolute;
    top: 0;
    left: 0;
    padding: 4px 9px;
    border-radius: 7px;
    background: var(--pf-text-primary, #0f172a);
    color: var(--pf-bg-card, #fff);
    font: 700 12px/1.3 'Inter', sans-serif;
    white-space: nowrap;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

.pf-trend-chart__bubble[hidden] {
    display: none;
}

.pf-trend-detail__hint {
    margin: 8px 0 12px;
    font-size: 12px;
    color: var(--pf-text-muted, #64748b);
    line-height: 1.45;
}

.pf-trend-detail__hint-mouse {
    display: none;
}

@media (hover: hover) and (pointer: fine) {
    .pf-trend-detail__hint-touch {
        display: none;
    }
    .pf-trend-detail__hint-mouse {
        display: inline;
    }
}

.pf-trend-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.pf-trend-stats__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--pf-border, #e2e8f0);
    border-radius: 10px;
    min-width: 0;
}

.pf-trend-stats__label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--pf-text-muted, #64748b);
}

.pf-trend-stats__val {
    font-size: 15px;
    font-weight: 800;
    color: var(--pf-text-primary, #0f172a);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-trend-stats__val--low {
    color: var(--pf-trend-low);
}

.pf-trend-stats__val--now {
    color: var(--pf-trend-line, #0f4c81);
}

.pf-trend-stats__sub {
    font-size: 11px;
    color: var(--pf-text-muted, #64748b);
    min-height: 1em;
}

@media (max-width: 575.98px) {
    .pf-trend-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ---- Alt sayfa / modal ---- */
.pf-trend-modal .modal-content {
    border: 0;
    border-radius: 16px;
    background: var(--pf-bg-card, #fff);
    color: var(--pf-text-primary, #0f172a);
}

.pf-trend-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 6px;
}

.pf-trend-modal__title {
    margin: 0;
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 800;
}

.pf-trend-modal__product {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--pf-text-muted, #64748b);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pf-trend-modal__body {
    padding: 6px 18px 18px;
}

.pf-trend-modal__grab {
    display: none;
}

@media (max-width: 575.98px) {
    .pf-trend-modal .modal-dialog {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        max-width: none;
        width: 100%;
        transform: translateY(100%);
        transition: transform 0.28s ease-out;
    }
    .pf-trend-modal.show .modal-dialog {
        transform: none;
    }
    .pf-trend-modal .modal-content {
        border-radius: 18px 18px 0 0;
        max-height: 92vh;
        max-height: 92dvh;
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    .pf-trend-modal__grab {
        display: flex;
        justify-content: center;
        padding: 10px 0 2px;
        touch-action: none;
    }
    .pf-trend-modal__grab::before {
        content: '';
        width: 40px;
        height: 4px;
        border-radius: 2px;
        background: var(--pf-border, #cbd5e1);
    }
    .pf-trend-modal__head {
        padding-top: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pf-trend-modal .modal-dialog {
        transition: none;
    }
}
