/* Delivery date card and calendar dialog. Accent follows WoodMart's primary color when available. */
.cdc-root {
    --cdc-accent: var(--wd-primary-color, #b87333);
    --cdc-text: #242424;
    --cdc-muted: #767676;
    --cdc-border: rgba(0, 0, 0, 0.1);
    --cdc-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--cdc-text);
}

.cdc-root [hidden],
.cdc-slot[hidden] {
    display: none !important;
}

/* ---- Date card above the checkout buttons ---- */
/* Buttons are scoped under .cdc-root to beat the theme's button styles */

.cdc-slot {
    margin: 0 0 16px;
}

.cdc-root .cdc-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--cdc-border);
    border-radius: 12px;
    background: #fff;
    color: var(--cdc-text);
    box-shadow: none;
    font: inherit;
    font-size: 14px;
    line-height: 1.3;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.cdc-root .cdc-card:hover {
    border-color: var(--cdc-accent);
    background: #fff;
    color: var(--cdc-text);
}

.cdc-root .cdc-card:focus-visible {
    outline: 2px solid var(--cdc-accent);
    outline-offset: 2px;
}

.cdc-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--cdc-accent) 12%, #fff);
    color: var(--cdc-accent);
}

.cdc-card__text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cdc-card__label {
    color: var(--cdc-muted);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.cdc-card__value {
    font-size: 15px;
    font-weight: 600;
}

.cdc-card__action {
    flex: none;
    color: var(--cdc-accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* No date yet: it's required, so make it stand out */
.cdc-root .cdc-card--empty,
.cdc-root .cdc-card--empty:hover {
    border-color: var(--cdc-accent);
    background: color-mix(in srgb, var(--cdc-accent) 7%, #fff);
}

.cdc-card--empty .cdc-card__value {
    color: var(--cdc-accent);
}

.cdc-card--empty .cdc-card__action {
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--cdc-accent);
    color: #fff;
    text-decoration: none;
}

/* ---- Header button next to the cart ---- */

.cdc-root.cdc-header-slot {
    display: flex;
    align-items: center;
    /* not the card's bottom margin; side padding like the theme's other header tools */
    margin: 0;
    padding: 0 6px;
}

.cdc-root .cdc-header {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    min-height: 0;
    margin: 0;
    padding: 0 14px 0 10px;
    border: 1px solid var(--cdc-border);
    border-radius: 999px;
    background: #fff;
    color: var(--cdc-text);
    box-shadow: none;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.cdc-root .cdc-header:hover {
    border-color: var(--cdc-accent);
    background: #fff;
    color: var(--cdc-text);
}

.cdc-root .cdc-header:focus-visible {
    outline: 2px solid var(--cdc-accent);
    outline-offset: 2px;
}

.cdc-header__icon {
    position: relative;
    display: flex;
    color: var(--cdc-accent);
}

/* Only shown on phones, where the text is hidden */
.cdc-header__badge {
    display: none;
}

.cdc-root .cdc-header--empty {
    border-color: var(--cdc-accent);
    color: var(--cdc-accent);
}

/* Icon only, like the cart next to it: on WoodMart's mobile header (below 1025px), and on narrower
   desktop headers (tablets in landscape), where the full pill pushes the menu onto a second line */
@media (max-width: 1279px) {
    .cdc-root .cdc-header,
    .cdc-root .cdc-header:hover {
        height: 40px;
        padding: 0 6px;
        border: 0;
        background: transparent;
    }

    .cdc-header__value {
        display: none;
    }

    .cdc-header__icon svg {
        width: 24px;
        height: 24px;
    }

    .cdc-header__badge {
        position: absolute;
        top: -5px;
        right: -7px;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 15px;
        height: 15px;
        border-radius: 50%;
        background: var(--cdc-accent);
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        line-height: 1;
    }

    /* Date picked: a small check instead of the "!" */
    .cdc-header__badge:empty::before {
        content: "";
        width: 6px;
        height: 3px;
        margin-top: -2px;
        border-left: 1.5px solid currentColor;
        border-bottom: 1.5px solid currentColor;
        transform: rotate(-45deg);
    }
}

/* ---- Dialog ---- */

.cdc-dialog-open {
    overflow: hidden;
}

.cdc-dialog {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.cdc-dialog__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.cdc-dialog__panel {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 26px 26px 22px;
    border-radius: var(--cdc-radius);
    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    outline: none;
}

.cdc-root .cdc-dialog__close {
    position: absolute;
    top: 14px;
    right: 14px;
    left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--cdc-muted);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.cdc-root .cdc-dialog__close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--cdc-text);
}

.cdc-dialog__title {
    margin: 0 40px 8px 0;
    font-size: 20px;
    line-height: 1.25;
}

.cdc-intro {
    margin: 0 0 16px;
    color: var(--cdc-muted);
    font-size: 14px;
    line-height: 1.5;
}

/* Why the earliest date is what it is */
.cdc-lead {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 0 0 20px;
    padding: 11px 14px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--cdc-accent) 9%, #fff);
    color: var(--cdc-text);
    font-size: 13px;
    line-height: 1.45;
}

.cdc-lead svg {
    flex: none;
    margin-top: 1px;
    color: var(--cdc-accent);
}

/* Bottom sheet on phones */
@media (max-width: 600px) {
    .cdc-dialog {
        align-items: flex-end;
        padding: 0;
    }

    .cdc-dialog__panel {
        max-width: none;
        max-height: 90vh;
        border-radius: var(--cdc-radius) var(--cdc-radius) 0 0;
        padding: 22px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    }
}

/* ---- Calendar ---- */

.cdc-cal[aria-busy="true"] {
    opacity: 0.7;
}

.cdc-cal {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--cdc-border);
}

.cdc-cal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cdc-cal__month {
    font-weight: 600;
}

.cdc-root .cdc-cal__nav {
    width: 34px;
    height: 34px;
    min-height: 0;
    padding: 0 0 2px;
    border: 1px solid var(--cdc-border);
    border-radius: 50%;
    background: #fff;
    color: var(--cdc-text);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.cdc-root .cdc-cal__nav:disabled {
    opacity: 0.3;
    cursor: default;
}

.cdc-cal__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
}

.cdc-cal__wd {
    padding: 4px 0;
    color: var(--cdc-muted);
    font-size: 11px;
    text-align: center;
    text-transform: uppercase;
}

/* Empty cells before the 1st and after the last day; as tall as a day so all six rows always take space */
.cdc-cal__blank {
    height: 40px;
}

.cdc-root .cdc-day {
    height: 40px;
    min-height: 0;
    width: 100%;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    background: color-mix(in srgb, var(--cdc-accent) 8%, #fff);
    color: var(--cdc-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.cdc-root .cdc-day:hover,
.cdc-root .cdc-day:focus-visible {
    border-color: var(--cdc-accent);
    background: color-mix(in srgb, var(--cdc-accent) 8%, #fff);
    color: var(--cdc-text);
    outline: none;
}

.cdc-root .cdc-day:disabled {
    /* The theme fades disabled buttons with "opacity: .6 !important"; the colour below is the only dimming wanted */
    opacity: 1 !important;
    background: transparent;
    color: #c4c4c4;
    font-weight: 400;
    text-decoration: line-through;
    cursor: default;
}

.cdc-root .cdc-day--today {
    position: relative;
}

/* Today is usually not bookable, but should still be easy to find: readable number, no strike-through */
.cdc-root .cdc-day--today:disabled {
    color: var(--cdc-muted);
    font-weight: 600;
    text-decoration: none;
}

.cdc-root .cdc-day--today::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 5px;
    width: 5px;
    height: 5px;
    margin-left: -2.5px;
    border-radius: 50%;
    background: var(--cdc-accent);
}

/* On the filled accent background of a picked day */
.cdc-root .cdc-day--today[aria-pressed="true"]::after,
.cdc-root .cdc-day--today.cdc-day--saving::after {
    background: #fff;
}

.cdc-root .cdc-day[aria-pressed="true"],
.cdc-root .cdc-day--saving,
.cdc-root .cdc-day[aria-pressed="true"]:hover {
    border-color: var(--cdc-accent);
    background: var(--cdc-accent);
    color: #fff;
}

.cdc-root .cdc-day[aria-pressed="true"]:disabled {
    text-decoration: none;
}

/* ---- Below the calendar ---- */

.cdc-day-info {
    padding-top: 18px;
    /* scrollIntoView() keeps it clear of the sticky confirm bar */
    scroll-margin-bottom: 96px;
}

.cdc-day-info__stack {
    display: grid;
}

.cdc-day-info__stack > * {
    grid-area: 1 / 1;
}

.cdc-day-info__stack > [data-cdc-inactive] {
    visibility: hidden;
}

.cdc-day-info__label {
    margin: 0 0 2px;
    color: var(--cdc-muted);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.cdc-day-info__date {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 600;
}

.cdc-day-info__methods {
    margin: 0;
    padding: 0;
    list-style: none;
}

.cdc-day-info__methods li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 0;
    padding: 9px 0;
    border-top: 1px solid var(--cdc-border);
    font-size: 14px;
    line-height: 1.4;
}

.cdc-day-info__methods li:first-child {
    border-top: 0;
    padding-top: 0;
}

.cdc-day-info__methods svg {
    flex: none;
    margin-top: 2px;
    color: var(--cdc-accent);
}

.cdc-day-info__hint {
    margin: 0;
    color: var(--cdc-muted);
    font-size: 14px;
}

/* Touch screens: confirm the tapped day. Negative margins span the panel's padding. */
.cdc-confirm {
    position: sticky;
    bottom: -22px;
    margin: 18px -26px -22px;
    padding: 14px 26px 22px;
    border-top: 1px solid var(--cdc-border);
    background: #fff;
}

.cdc-root .cdc-confirm__button {
    display: block;
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 14px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--cdc-accent);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
}

.cdc-root .cdc-confirm__button:hover,
.cdc-root .cdc-confirm__button:focus-visible {
    background: color-mix(in srgb, var(--cdc-accent) 88%, #000);
    color: #fff;
}

.cdc-root .cdc-confirm__button:disabled {
    opacity: 0.6;
    cursor: default;
}

@media (max-width: 600px) {
    .cdc-confirm {
        bottom: calc(-18px - env(safe-area-inset-bottom, 0px));
        margin: 18px -18px calc(-18px - env(safe-area-inset-bottom, 0px));
        padding: 12px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    }
}

.cdc-status {
    margin: 14px 0 0;
    color: var(--cdc-muted);
}

.cdc-notice {
    margin: 0 0 16px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
}

.cdc-notice--warning {
    background: #fff6e5;
    color: #7a4b00;
}

.cdc-notice--error {
    margin: 14px 0 0;
    background: #fdecec;
    color: #8a1f1f;
}

/* ---- "Add to calendar" card on the thank-you page / My Account order ---- */

.cdc-add-to-calendar {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin: 0 0 32px;
    padding: 18px 20px;
    border: 1px solid var(--cdc-border);
    border-radius: var(--cdc-radius);
    background: #fff;
}

.cdc-add-to-calendar__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--cdc-accent) 12%, #fff);
    color: var(--cdc-accent);
}

.cdc-add-to-calendar__body {
    flex: 1;
    min-width: 0;
}

.cdc-root .cdc-add-to-calendar__title {
    margin: 0 0 2px;
    font-size: 16px;
    font-weight: 600;
}

.cdc-root .cdc-add-to-calendar__when {
    margin: 0 0 14px;
    color: var(--cdc-muted);
    font-size: 14px;
    line-height: 1.45;
}

.cdc-root .cdc-add-to-calendar__map {
    color: var(--cdc-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cdc-add-to-calendar__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cdc-root .cdc-calendar-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--cdc-border);
    border-radius: 999px;
    background: #fff;
    color: var(--cdc-text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    transition: border-color 0.15s ease;
}

.cdc-root .cdc-calendar-link:hover,
.cdc-root .cdc-calendar-link:focus-visible {
    border-color: var(--cdc-accent);
    color: var(--cdc-text);
    text-decoration: none;
}

.cdc-calendar-link svg {
    flex: none;
}

@media (max-width: 600px) {
    .cdc-add-to-calendar {
        padding: 16px;
    }

    .cdc-add-to-calendar__icon {
        width: 38px;
        height: 38px;
    }

    .cdc-root .cdc-calendar-link {
        flex: 1 1 100%;
        justify-content: center;
    }
}
