/*
 * dmhistoryprice - front office. Soběstačné styly, žádná závislost na
 * Bootstrapu tématu (funguje v Classic i Hummingbird). Mobile-first.
 */

/* rychlonáhled produktu graf nezobrazuje (1:1 se starým chováním) */
.quickview .dmhp-only-product {
    display: none;
}

/* ─── Spouštěcí odkaz ──────────────────────────────────────────────────── */
.dmhp-block {
    margin: .75rem 0;
}

.dmhp-trigger {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .9rem;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: .9rem;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.dmhp-trigger:hover {
    background: rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .3);
}

.dmhp-trigger:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.dmhp-trigger-icon svg {
    width: 1.1em;
    height: 1.1em;
    display: block;
}

/* ─── Textový blok s nejnižší cenou ────────────────────────────────────── */
.dmhp-lowest {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: .5rem 0;
    font-size: .85rem;
    opacity: .85;
}

.dmhp-lowest svg {
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
}

.dmhp-lowest b {
    white-space: nowrap;
}

/* ─── Inline graf (patička, plná šířka) ────────────────────────────────── */
.dmhp-inline {
    width: 100%;
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 12px;
    box-sizing: border-box;
}

.dmhp-inline-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin-bottom: .35rem;
}

.dmhp-inline-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.3;
}

.dmhp-inline-text {
    margin: 0 0 1rem;
    font-size: .85rem;
    line-height: 1.5;
    opacity: .75;
    max-width: 70ch;
}

.dmhp-inline .dmhp-chart-wrap {
    height: 320px;
}

@media (max-width: 576px) {
    .dmhp-inline {
        padding: 1rem;
    }

    .dmhp-inline .dmhp-chart-wrap {
        height: 240px;
    }
}

/* ─── Modal ────────────────────────────────────────────────────────────── */
.dmhp-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.dmhp-modal[hidden] {
    display: none;
}

.dmhp-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: dmhp-fade .18s ease-out;
}

.dmhp-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 720px;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    background: #fff;
    color: #1f2937;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, .35);
    padding: 1.25rem 1.25rem 1.5rem;
    animation: dmhp-pop .22s cubic-bezier(.2, .9, .3, 1.2);
}

@keyframes dmhp-fade {
    from { opacity: 0; }
}

@keyframes dmhp-pop {
    from { opacity: 0; transform: translateY(14px) scale(.97); }
}

@media (prefers-reduced-motion: reduce) {
    .dmhp-modal-backdrop,
    .dmhp-modal-dialog {
        animation: none;
    }
}

body.dmhp-modal-open {
    overflow: hidden;
}

.dmhp-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .5rem;
}

.dmhp-modal-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
}

.dmhp-demo-badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: .4rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, .15);
    color: #b45309;
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .08em;
}

.dmhp-demo-badge[hidden] {
    display: none;
}

.dmhp-modal-product {
    margin: .15rem 0 0;
    font-size: .85rem;
    opacity: .7;
}

.dmhp-modal-close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .06);
    color: inherit;
    cursor: pointer;
    transition: background-color .15s ease;
}

.dmhp-modal-close:hover {
    background: rgba(0, 0, 0, .12);
}

.dmhp-modal-close:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.dmhp-modal-close svg {
    width: 1.1rem;
    height: 1.1rem;
}

.dmhp-modal-text {
    margin: 0 0 .9rem;
    font-size: .85rem;
    line-height: 1.5;
    opacity: .8;
}

/* ─── Odznak nejnižší ceny v okně ──────────────────────────────────────── */
.dmhp-lowest-badge {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .9rem;
    padding: .4rem .8rem;
    border-radius: 999px;
    background: rgba(16, 185, 129, .12);
    color: #047857;
    font-size: .85rem;
    font-weight: 600;
}

.dmhp-lowest-badge[hidden] {
    display: none;
}

.dmhp-lowest-badge svg {
    width: 1em;
    height: 1em;
}

/* ─── Graf ─────────────────────────────────────────────────────────────── */
.dmhp-chart-wrap {
    position: relative;
    height: 300px;
}

.dmhp-chart-wrap canvas {
    max-width: 100%;
}

.dmhp-chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-size: .9rem;
    opacity: .7;
    text-align: center;
}

.dmhp-chart-empty[hidden] {
    display: none;
}

.dmhp-chart-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .6);
    z-index: 2;
}

.dmhp-chart-loading[hidden] {
    display: none;
}

.dmhp-spinner {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 3px solid rgba(0, 0, 0, .12);
    border-top-color: rgba(0, 0, 0, .55);
    animation: dmhp-spin .7s linear infinite;
}

@keyframes dmhp-spin {
    to { transform: rotate(360deg); }
}

/* ─── Mobil ────────────────────────────────────────────────────────────── */
@media (max-width: 576px) {
    .dmhp-modal {
        padding: 0;
        align-items: flex-end;
    }

    .dmhp-modal-dialog {
        max-width: none;
        max-height: 92vh;
        max-height: 92dvh;
        border-radius: 16px 16px 0 0;
        padding: 1rem 1rem 1.25rem;
    }

    .dmhp-chart-wrap {
        height: 230px;
    }
}
