/**
 * Frontend Styles — EZ Travel Toolbox
 * 前台：螢光筆、邊框、容器（含流光邊框）
 */

/* ── 螢光筆 ── */
.ez-highlighter {
    display: inline;
    padding: 0 2px;
    background: linear-gradient(transparent 40%, rgba(17, 208, 115, 0.3) 40%);
    color: inherit;
}

.ez-highlighter.is-brand { background: linear-gradient(transparent 40%, rgba(17, 208, 115, 0.3) 40%) !important; }
.ez-highlighter.is-yellow { background: linear-gradient(transparent 40%, rgba(255, 242, 0, 0.3) 40%) !important; }
.ez-highlighter.is-pink { background: linear-gradient(transparent 40%, rgba(255, 192, 203, 0.3) 40%) !important; }
.ez-highlighter.is-blue { background: linear-gradient(transparent 40%, rgba(0, 160, 233, 0.3) 40%) !important; }

/* ── 邊框（行內與區塊） ── */
.ez-inline-border,
[class^="ez-border-"] {
    display: inline-block !important;
    vertical-align: middle;
    margin: 4px 2px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    text-decoration: none !important;
    color: inherit;
}

.ez-border-content {
    display: inline;
    padding: 0;
}

.ez-border-brand .ez-border-content,
.ez-border-red-left .ez-border-content,
.ez-border-simple .ez-border-content,
.ez-border-container .ez-border-content {
    display: block !important;
    margin-top: 10px;
}

.ez-border-title {
    display: inline-block;
    background: #11D073;
    color: #fff;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 4px;
    margin-right: 5px;
    font-weight: bold;
    vertical-align: baseline;
}

.ez-border-brand,
.ez-border-standard {
    border: 2px solid #11D073 !important;
    background-color: rgba(17, 208, 115, 0.05) !important;
}

.ez-border-label {
    border: 2px solid #11D073 !important;
    padding-top: 26px !important;
    position: relative !important;
    background-color: #fff !important;
    min-width: 80px;
}

.ez-border-label::before {
    content: attr(data-title);
    position: absolute;
    top: 0;
    left: 0;
    background: #11D073;
    color: #fff;
    font-size: 10px;
    padding: 2px 8px;
    border-bottom-right-radius: 4px;
    font-weight: bold;
    line-height: 1.2;
    z-index: 1;
}

.ez-border-label:not([data-title])::before {
    content: '編輯小補充';
}

.ez-border-label:has(.ez-border-title)::before {
    display: none !important;
}

.ez-border-label .ez-border-title {
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    border-radius: 0;
    border-bottom-right-radius: 4px;
    z-index: 2;
}

.ez-border-button {
    --btn-bg: #11D073;
    --btn-color: #fff;
    --btn-shadow: rgba(17, 208, 115, 0.3);

    background-color: var(--btn-bg) !important;
    color: var(--btn-color) !important;
    padding: 4px 12px !important;
    border-radius: 50px !important;
    text-align: center;
    box-shadow: 0 2px 6px var(--btn-shadow) !important;
    font-weight: bold;
    cursor: pointer;
}

.ez-border-button:hover {
    filter: brightness(0.9);
    box-shadow: 0 4px 8px var(--btn-shadow) !important;
    transform: translateY(-1px);
}

.ez-border-guide {
    border: 1px solid #ddd !important;
    border-left: 5px solid #11D073 !important;
    background: #f9f9f9 !important;
    padding: 6px 10px !important;
    cursor: pointer;
}

.ez-border-guide:hover {
    background: #f0f0f0 !important;
    border-color: #ccc !important;
}

.ez-border-guide::after {
    content: ' ➔';
    font-weight: bold;
}

.ez-border-red-left {
    border-left: 4px solid #ff0000 !important;
    background: #fff5f5 !important;
    border-radius: 0 !important;
}

.ez-border-red-left .ez-border-title {
    background: #ff0000;
}

.ez-border-simple {
    border: 1px solid #ccc !important;
    background: transparent !important;
}

.ez-border-simple .ez-border-title {
    background: #666;
}

/* ── 容器 ── */
.ez-container-box {
    position: relative;
    border-style: solid;
    margin: 20px 0;
    box-sizing: border-box;
    box-shadow: var(--ez-box-shadow, 0 2px 10px rgba(0, 0, 0, 0.05));
    width: 100%;
    display: block;
    gap: var(--ez-container-gap, var(--ez-gap, 20px));
}

.ez-container-box.has-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
}

.ez-container-box.has-ez-label {
    border-top-left-radius: 0 !important;
}

.ez-container-box.has-ez-label.ez-container-animated::after {
    border-top-left-radius: 0 !important;
}

.ez-container-label {
    position: absolute;
    top: 0;
    left: calc( -1 * var(--ez-border-width, 0px) );
    transform: translateY(-100%);
    background: var(--ez-border-color, #11D073) !important;
    color: #fff;
    padding: 5px 14px;
    font-size: 14px;
    font-weight: bold;
    z-index: 10;
    white-space: nowrap;
    line-height: 1.2;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    margin: 0;
}

.ez-container-content {
    width: 100%;
}

.ez-container-box.has-title {
    margin-top: 40px;
}

.ez-container-box img[src$=".svg"]:not([width]) {
    width: 1em;
}

/* 流光邊框 */
@property --rotate-post-card {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

@keyframes rotatepostcard {
    from { --rotate-post-card: 0deg; }
    to { --rotate-post-card: 360deg; }
}

.ez-container-animated {
    position: relative !important;
    z-index: 0;
    overflow: hidden !important;
    border-color: transparent !important;
}

.ez-container-animated::before {
    content: "";
    background: conic-gradient(
        from var(--rotate-post-card),
        transparent 0%,
        var(--ez-glow-color, #11D073) 5%,
        transparent 50%
    );
    position: absolute;
    inset: -100%;
    animation: rotatepostcard 5s linear infinite;
    z-index: -2;
}

.ez-container-animated::after {
    content: "";
    background: inherit;
    position: absolute;
    inset: var(--ez-border-width, 2px);
    border-radius: calc(var(--ez-radius, 8px) - var(--ez-border-width, 2px));
    z-index: -1;
}

.ez-container-animated > * {
    position: relative;
    z-index: 1;
}

/* 覆蓋 WP 全域 constrained 子元素 margin */
.ez-container-box.is-layout-flex > *:not(.ez-container-label),
.ez-container-box.is-layout-grid > *:not(.ez-container-label) {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* ── 佈局預設與 Stretch ── */
.ez-container-box.is-stretched:not(.mode-sideBySide) > *:not(.ez-container-label) {
    flex: 1 1 auto;
    min-width: 0;
}

.ez-container-box.mode-sideBySide {
    display: flex !important;
    align-items: stretch !important;
    gap: var(--ez-container-gap, var(--ez-gap, 20px)) !important;
}

/* 圖文左右：第一欄（圖）固定寬度，第二欄（內容）填滿剩餘 */
.ez-container-box.mode-sideBySide.has-ez-label > *:nth-child(2):not(.ez-container-label),
.ez-container-box.mode-sideBySide:not(.has-ez-label) > *:nth-child(1) {
    flex: 0 0 auto;
    width: auto;
    max-width: 100%;
}

.ez-container-box.mode-sideBySide.has-ez-label > *:nth-child(3),
.ez-container-box.mode-sideBySide:not(.has-ez-label) > *:nth-child(2) {
    display: flex;
    flex-direction: column;
    justify-content: var(--ez-content-justify, space-between);
    flex: 1 1 0%;
    min-width: 0;
    min-height: 100%;
    align-self: stretch;
}

.ez-container-box.mode-sideBySide.has-ez-label > *:nth-child(3) > .wp-block-group__inner-container,
.ez-container-box.mode-sideBySide:not(.has-ez-label) > *:nth-child(2) > .wp-block-group__inner-container {
    display: flex;
    flex-direction: column;
    justify-content: var(--ez-content-justify, space-between);
    flex: 1 1 auto;
    min-height: 100%;
    width: 100%;
}

.ez-container-box.mode-sideBySide .is-horizontal{
    margin-right: 0 !important;
}

.ez-container-box.mode-sideBySide figure{
    margin-bottom: 0;
}

/* 向後推開 / 向前推開（橫列內 Price ←→ Button） */
.ez-container-box .is-style-ez-flex-push-after,
.ez-container-box .wp-block-group.is-style-ez-flex-push-after {
    margin-right: auto !important;
}

.ez-container-box .is-style-ez-flex-push-before,
.ez-container-box .wp-block-group.is-style-ez-flex-push-before {
    margin-left: auto !important;
}

.ez-container-box.mode-gridCard {
    display: flex;
    flex-direction: column;
}

.ez-container-box.mode-gridCard > *:not(.ez-container-label) {
    width: 100%;
    max-width: 100%;
}

@media (max-width: 768px) {
    .ez-container-box.has-flex {
        flex-direction: column;
    }

    .ez-container-box.mode-sideBySide {
        flex-direction: column !important;
    }

    .ez-container-box.mode-sideBySide.has-ez-label > *:nth-child(2):not(.ez-container-label),
    .ez-container-box.mode-sideBySide:not(.has-ez-label) > *:nth-child(1) {
        flex: 0 0 auto;
        max-width: 100%;
    }

    .ez-container-box.mode-sideBySide.has-ez-label > *:nth-child(3),
    .ez-container-box.mode-sideBySide:not(.has-ez-label) > *:nth-child(2) {
        flex: 1 1 auto;
        width: 100%;
    }
}
