/* ============================================================
   TMC Locations — Front-end widget styles
   Intentionally minimal: visual styling is handled via
   Elementor's Style tab controls. These are structural defaults.
   ============================================================ */

/* ── Hours Table ─────────────────────────────────────────── */

.tmc-hours-table {
    width: 100%;
}

/*
 * Each row is a flex container:
 *   - Day span: grows to fill available space, wraps if needed.
 *   - Time span: never shrinks, never wraps — always stays on one line.
 * This replaces the old <table> two-column layout, eliminating fixed
 * percentage widths and theme-injected <td> border resets.
 */
.tmc-hours-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1em;
    /* Visual baseline for the "Row padding" control (empty by default). */
    padding: 6px 0 6px 0;
}

/* Visual baseline for the "Row separator border" group control (width left
   empty by default). A 1px solid divider between rows; the colour matches the
   control's own colour default. Overridden by the Elementor Border control. */
.tmc-hours-table .tmc-hours-row:not(:last-child) {
    border-bottom: 1px solid #e0e0e0;
}

.tmc-hours-day {
    /* Grows naturally; wraps if the annotation makes it long. */
    flex: 1 1 auto;
    min-width: 0; /* allow text-overflow/wrap inside a flex child */
}

.tmc-hours-time {
    flex: 0 0 auto;   /* never shrink — time always shows on one line */
    text-align: right;
    white-space: nowrap;
}

.tmc-hours-day-annotation {
    /* Date / special-label annotation appended to the day name.
       Colour and typography can be overridden via Elementor controls. */
    opacity: 0.75;
}

/* Special hours badge (asterisk marker).
   position:relative instead of vertical-align:super so the badge lifts
   visually without expanding the flex row's line box height. */
.tmc-hours-special-badge {
    font-size: 0.75em;
    position: relative;
    top: -0.4em;
    margin-left: 0;
}

/* ── Simple layout ─────────────────────────────────────────
   Compact "Mon: 3 PM – 10 PM" form. Same DOM structure as the
   default table layout; only the flex arrangement differs, plus
   a ': ' separator inserted between day and time via ::after so
   no content changes are needed server-side. */
.tmc-hours-table--simple .tmc-hours-row {
    justify-content: flex-start;
    gap: 0.25em;
}
.tmc-hours-table--simple .tmc-hours-day {
    flex: 0 0 auto;
}
.tmc-hours-table--simple .tmc-hours-day::after {
    content: ":";
    margin-right: 0.35em;
}
.tmc-hours-table--simple .tmc-hours-time {
    text-align: left;
}

/* Notes block below the table. */
.tmc-hours-note {
    margin-top: 10px;
    font-size: 0.85em;
    opacity: 0.75;
    line-height: 1.5;
}

/* Notice block above the special-hours dates list. Visual baseline for the
   "Space above" / "Space below" controls (empty by default in the editor). */
.tmc-hours-notice {
    margin-top: 10px;
    margin-bottom: 6px;
}

/* ── Open Status ─────────────────────────────────────────── */

/* inline-flex on the parent vertically centres all children (name, separator,
   state, time) regardless of their individual sizes — solves the issue of FA
   icons sitting on the baseline instead of the visual centre.

   line-height: 1 collapses the inline-flex container down to its content
   height. Without this, the widget can inherit the page's body line-height
   (e.g. 1.6 or 1.8 from a theme) and produce a tall line box that pads the
   Elementor widget container vertically. */
.tmc-open-status {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    line-height: 1;
}

/* The Elementor widget container is block-level and inherits its line-height
   from the page body (commonly 1.6 ≈ 28px at 16px base). Our widget is an
   inline-flex inside that block, so the LINE BOX wrapping the widget gets
   that 28px height even though the widget itself is only ~15px tall. Result:
   ~13px of dead space above + below the widget.

   `line-height: 0` collapses the container's "strut" (the invisible line-box-
   height reserved at the container's own font-size) so the actual line box
   shrinks to fit the inline-flex widget exactly. The widget itself re-asserts
   `line-height: 1` above, so text inside the widget still has a sensible
   line-height. Scoped to our widget type so we don't touch other widgets. */
.elementor-widget-tmc-open-status .elementor-widget-container {
    line-height: 0;
}

/* `:not([hidden])` is required because our `display: inline-flex` rule below
   would otherwise override the browser UA `[hidden] { display: none }` rule
   (both have the same specificity, ours comes later → wins). When the
   "Show location name" toggle is off, the widget still emits the leading
   separator span with `hidden` attribute — without this scoping that span
   would render as a stray dot at the start of the widget. */
.tmc-open-status__sep:not([hidden]) {
    display: inline-flex;
    align-items: center;
    font-size: 6px; /* default separator icon size; overridden by Elementor control */
    line-height: 1;
    margin: 0 0.4em;
}

/* Elementor's `Icons_Manager::render_icon()` outputs `<svg class="e-font-icon-svg ...">`
   without inline width/height attributes — it relies on Elementor's global
   `.e-font-icon-svg { width: 1em; height: 1em; fill: currentColor; }` rule,
   which isn't always enqueued on pages that don't otherwise use a font-icon
   widget. Without it, the SVG renders at 0×0 and the separator disappears.
   Style it ourselves so the widget is self-contained. The 1em sizing pairs
   with the separator's font-size control. */
.tmc-open-status__sep svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
    display: block; /* avoid the trailing baseline gap inline SVGs leave */
}

.tmc-open-status__name {
    /* Inherits colour; override via Elementor controls. */
}

/* ── Location Card ───────────────────────────────────────── */

.tmc-location-card {
    /* Structure only — all visual styling via Elementor controls. */
}

.tmc-location-card > * + * {
    margin-top: 8px; /* default row spacing; overridden by Elementor control */
}

/* Alt-name "Spacing above" baseline. The doubled class (0,2,0) matches the
   Elementor "Spacing above" control's selector specificity and beats the
   row-spacing `> * + *` rule (also 0,2,0) on source order, so the alt name
   keeps its tight 2px gap below the main name when the control is empty.
   Overridden once the user sets the "Spacing above" control. */
.tmc-location-card__alt-name.tmc-location-card__alt-name {
    margin-top: 2px;
}

.tmc-location-card__address {
    white-space: pre-line; /* preserves \n line breaks in formatted address */
}

/* Alt name appears below the regular name in "both" mode.
   Default is slightly lighter than the main name; overridable via Elementor's
   Alt Name style section. The row-spacing rule (> * + *) already gives it
   full row spacing — the Alt Name "Spacing above" control overrides that. */
.tmc-location-card__alt-name {
    font-size: 0.9em;
    opacity: 0.8;
}

/* Phone / email rows with icons use flex for alignment. */
.tmc-location-card__phone,
.tmc-location-card__email {
    display: flex;
    align-items: center;
    gap: 8px; /* default icon gap; overridden by Elementor control */
}

.tmc-location-card__icon {
    flex: 0 0 auto;
    line-height: 1;
}

.tmc-location-card__icon svg {
    fill: currentColor;
    width: 1em;
    height: 1em;
}

/* ── Holiday Banner ───────────────────────────────────────── */

.tmc-holiday-banner {
    display: flex;
    align-items: center;
    gap: 10px; /* baseline for "Icon gap" control (empty by default) */
    /* Baselines for the Padding and Border radius controls (empty by default
       in the editor). Overridden once the user sets those controls. */
    padding: 12px 16px 12px 16px;
    border-radius: 4px;
}

.tmc-holiday-banner__icon {
    flex: 0 0 auto;
    line-height: 1;
}

.tmc-holiday-banner__icon svg {
    fill: currentColor;
    width: 1em;
    height: 1em;
}

.tmc-holiday-banner__text {
    flex: 1 1 auto;
}

/* ── Location Map ─────────────────────────────────────────── */

.tmc-location-map {
    width: 100%;
    min-height: 200px;
    background: #eaeaea;
    /* Baseline for the "Border radius" control (empty by default). */
    border-radius: 4px;
}

/* ── Store Finder ─────────────────────────────────────────── */

.tmc-finder {
    width: 100%;
}

.tmc-finder__form {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

/* Specificity: 0-2-0 beats the kit's `.elementor-kit-N button` (0-1-1) and the
   hover rule (0-3-0) beats `.elementor-kit-N button:hover` (0-2-1); the widget's
   own {{WRAPPER}} controls sit at 0-3-0 / 0-4-0 and still win. */
.tmc-finder .tmc-finder__input {
    flex: 1 1 auto;
    padding: 8px 12px;
    font: inherit;
    font-size: 14px;
    color: inherit;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    min-width: 0;
}

.tmc-finder .tmc-finder__input:focus {
    outline: 2px solid transparent;
    border-color: #1d2327;
}

.tmc-finder .tmc-finder__submit {
    flex: 0 0 auto;
    padding: 8px 16px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    background: #1d2327;
    color: #fff;
    border: 1px solid #1d2327;
    border-radius: 4px;
    cursor: pointer;
}

.tmc-finder .tmc-finder__submit:hover,
.tmc-finder .tmc-finder__submit:focus-visible {
    background: #3c434a;
    border-color: #3c434a;
    color: #fff;
}

/* State colour via an attribute the JS sets, NOT an inline style: an inline
   style would beat the widget's status_color control. 0-2-0 here, so the
   {{WRAPPER}} control (0-3-0) still wins. */
.tmc-finder__status {
    font-size: 13px;
    margin-bottom: 10px;
    min-height: 1.4em;
}
.tmc-finder__status[data-state="busy"]  { color: #646970; }
.tmc-finder__status[data-state="error"] { color: #b32d2e; }
.tmc-finder__status[data-state="ok"]    { color: #00a32a; }

.tmc-finder__map {
    width: 100%;
    min-height: 200px; /* the map_height control's floor; a larger baseline silently clamped it */
    border-radius: 4px;
    margin-bottom: 12px;
}

.tmc-finder__results {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tmc-finder__item {
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: border-color 0.1s;
}

.tmc-finder__item-name {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

.tmc-finder__item-distance {
    font-size: 0.85em;
    opacity: 0.75;
    white-space: nowrap;
}

.tmc-finder__item-address {
    font-size: 0.9em;
    opacity: 0.8;
    margin-top: 3px;
}

.tmc-finder__item-status {
    font-size: 0.85em;
    margin-top: 3px;
}

.tmc-finder__item-directions {
    margin-top: 4px;
    font-size: 0.9em;
}

/* ── Location Switcher ───────────────────────────────────── */

.tmc-switcher-wrap {
    display: inline-block;
}

/* The trigger is a <button>, so without a baseline of its own it wears the
   theme's: Hello's reset.css paints every button with a 1px #c36 border and
   #c36 text. 0-2-0 beats `.elementor-kit-N button` (0-1-1); the hover rule at
   0-3-0 beats `button:hover` (0-2-1); {{WRAPPER}} controls still win. The
   border is transparent so a widget background colour shows no seam. */
.tmc-switcher-wrap .tmc-switcher-btn {
    display: inline-block;
    padding: 10px 18px;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    background: #1d2327;
    color: #fff;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
}

/* The kit's hover / focus rule can also draw a border, round the corners or
   add a shadow, which would grow the button on hover. Restated here; the
   widget's Border, Border radius and Padding controls (0-4-0) still win. */
.tmc-switcher-wrap .tmc-switcher-btn:hover,
.tmc-switcher-wrap .tmc-switcher-btn:focus,
.tmc-switcher-wrap .tmc-switcher-btn:active {
    padding: 10px 18px;
    background: #1d2327;
    color: #fff;
    border: 1px solid transparent;
    border-radius: 4px;
    box-shadow: none;
}

.tmc-switcher-wrap .tmc-switcher-btn:hover,
.tmc-switcher-wrap .tmc-switcher-btn:focus-visible {
    background: #3c434a;
    color: #fff;
}

/* Switcher popup. The script opens it as a modal <dialog> inside the
   widget, so the Location list controls reach it; showModal() puts it in
   the top layer, above headers, transforms and overflow. The dialog itself
   is an invisible full-screen frame: the overlay inside draws the dimming
   and closes the list when clicked. */
.tmc-switcher-dialog {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
}
.tmc-switcher-dialog::backdrop {
    background: transparent;
}
.tmc-switcher-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tmc-switcher-modal {
    background: #fff;
    color: #1e1e1e;
    /* Inside the widget now, so it would inherit the widget's alignment
       and any header text styling; the list reads as it did on <body>. */
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    white-space: normal;
    border-radius: 8px;
    padding: 24px;
    min-width: 280px;
    max-width: 420px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

/* The close button and the rows are <button>s too, so they meet the same
   kit rules as the trigger above: `.elementor-kit-N button` (0-1-1) at rest
   and `button:hover` / `:focus` (0-2-1) in the states, plus Hello's
   `[type=button]:hover` (0-2-0) background. Scoped under the modal (0-2-0),
   with the states at 0-3-0 restating everything the kit sets, so nothing
   changes size or colour on hover. The Location list controls write from
   {{WRAPPER}} (three classes) at 0-4-0 and 0-5-0, so a value set there wins
   over every rule here, in every state. */
.tmc-switcher-modal .tmc-switcher-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    font-size: 22px;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    padding: 0;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
}

.tmc-switcher-modal .tmc-switcher-close:hover,
.tmc-switcher-modal .tmc-switcher-close:focus,
.tmc-switcher-modal .tmc-switcher-close:active {
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    color: inherit;
    text-transform: none;
    letter-spacing: normal;
}

.tmc-switcher-modal .tmc-switcher-close:hover {
    opacity: 1;
}

/* Visually-subtle title. Lives above the list; also serves as the dialog's
   accessible name via aria-labelledby. */
.tmc-switcher-title {
    font-size: 1.1em;
    font-weight: 600;
    margin: 0 40px 0 0; /* leave room for the close button in the corner */
    padding: 0;
    line-height: 1.3;
}

.tmc-switcher-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

/* Each row is a <button> inside an <li> so it's a real interactive control. */
.tmc-switcher-item-wrap {
    margin: 0;
    padding: 0;
}

.tmc-switcher-modal .tmc-switcher-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 0;
    border-radius: 4px;
    box-shadow: none;
    background: transparent;
    color: inherit;
    font: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    text-align: left;
    cursor: pointer;
    width: 100%;
}

/* Every state restates the rest look first (see the close button above);
   the hover tint and focus ring follow at the same specificity. */
.tmc-switcher-modal .tmc-switcher-item:hover,
.tmc-switcher-modal .tmc-switcher-item:focus,
.tmc-switcher-modal .tmc-switcher-item:active {
    padding: 10px 12px;
    border: 0;
    border-radius: 4px;
    box-shadow: none;
    background: transparent;
    color: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    outline: none;
}

.tmc-switcher-modal .tmc-switcher-item:hover,
.tmc-switcher-modal .tmc-switcher-item:focus-visible {
    background: #f5f5f5;
}

/* Restore a visible keyboard indicator for the button-row focus state. */
.tmc-switcher-modal .tmc-switcher-item:focus-visible {
    box-shadow: 0 0 0 2px #2271b1 inset;
}

.tmc-switcher-modal .tmc-switcher-close:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
    opacity: 1;
}

.tmc-switcher-item--active .tmc-switcher-item__name {
    font-weight: 600;
}

.tmc-switcher-item__info {
    flex: 1 1 auto;
    min-width: 0;
}

.tmc-switcher-item__name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tmc-switcher-item__address {
    font-size: 0.85em;
    opacity: 0.7;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Editor preview (Location list > Show the list in the editor): the same
   markup held in the page under the button. */
.tmc-switcher-overlay--preview {
    position: static;
    margin-top: 12px;
    padding: 24px;
    border-radius: 8px;
}

.tmc-switcher-distance {
    flex: 0 0 auto;
    font-size: 0.8em;
    opacity: 0.6;
    white-space: nowrap;
}
