/*
 * Tim Hortons Menu Plugin — th-menu.css  v2.1
 * Palette: #C8102E (red) · #F9F5EE (cream) · #ffffff · #1a1a1a
 * No blue anywhere. No glow on size buttons.
 */

:root {
    --red:         #C8102E;
    --red-dark:    #a50d26;
    --cream:       #F9F5EE;
    --cream-dark:  #EFE8DC;
    --white:       #ffffff;
    --black:       #1a1a1a;
    --muted:       #6b6b6b;
    --border:      #E4DAD0;
    --font:        'sofia_pro', Helvetica, Arial, sans-serif;
    --font-size:   100%;
    --line-height: 1.5;

    --card-shadow:       0 2px 10px rgba(0,0,0,.07), 0 0 1px rgba(0,0,0,.05);
    --card-shadow-hover: 0 12px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
    --modal-shadow:      0 24px 64px rgba(0,0,0,.20), 0 4px 16px rgba(0,0,0,.08);

    --pill:        999px;
    --card-radius: 18px;
    --transition:  .2s ease;
}

/* ── Reset — override any theme-injected blue ─────────── */
.thm-wrapper button,
.thm-wrapper input,
.thm-wrapper a {
    outline: none;
    -webkit-tap-highlight-color: transparent;
}
.thm-wrapper button:focus,
.thm-wrapper input:focus,
.thm-wrapper a:focus {
    outline: none;
    box-shadow: none;
}
/* Restore accessible focus only for keyboard nav */
.thm-wrapper button:focus-visible,
.thm-wrapper input:focus-visible,
.thm-wrapper a:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 2px;
    box-shadow: none;
}

/* ── Base ─────────────────────────────────────────────── */
.thm-wrapper {
    font-family: var(--font);
    font-size: var(--font-size);
    line-height: var(--line-height);
    color: var(--black);
    -webkit-font-smoothing: antialiased;
}
.thm-wrapper *, .thm-wrapper *::before, .thm-wrapper *::after { box-sizing: border-box; }

/* ── Category Homepage Grid ───────────────────────────── */
.thm-category-homepage {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 8px 0 40px;
}
@media (max-width: 900px) { .thm-category-homepage { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .thm-category-homepage { grid-template-columns: repeat(2, 1fr); } }

.thm-homepage-title {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin: 0 0 36px;
    color: var(--black);
}

.thm-cat-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    color: var(--black);
    padding: 8px 8px 16px;
    border-radius: var(--card-radius);
    border: 2px solid transparent;
    transition: background var(--transition), transform var(--transition), border-color var(--transition);
}
.thm-cat-tile:hover {
    background: var(--cream);
    transform: translateY(-3px);
    border-color: var(--border);
    text-decoration: none;
    color: var(--black);
}
.thm-cat-tile-image-wrap {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    overflow: hidden;
}
.thm-cat-tile-image {
    width: 100%; height: 100%;
    object-fit: contain;
    transition: transform var(--transition);
}
.thm-cat-tile:hover .thm-cat-tile-image { transform: scale(1.05); }
.thm-cat-tile-name {
    font-size: .9375rem;
    font-weight: 700;
    color: var(--black);
    line-height: 1.3;
}
.thm-cat-tile-count {
    display: block;
    font-size: .75rem; color: var(--muted); margin-top: 2px;
}
.thm-cat-tile-image-wrap { border-radius: var(--card-radius); }

/* ── Page header ──────────────────────────────────────── */
.thm-page-header { margin-bottom: 28px; }
.thm-back-link {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .875rem; font-weight: 600; color: var(--muted);
    text-decoration: none; margin-bottom: 16px;
    transition: color var(--transition);
}
.thm-back-link:hover { color: var(--red); text-decoration: none; }
.thm-page-title { font-size: 1.8rem; font-weight: 800; margin: 0 0 4px; color: var(--black); }
.thm-page-count  { font-size: .875rem; color: var(--muted); }

/* ── Search ───────────────────────────────────────────── */
.thm-search-bar {
    position: relative;
    margin: 0 auto 40px;
    max-width: 580px;
}
.thm-search-inner {
    display: flex; align-items: center;
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--pill);
    height: 56px; padding: 0 22px; gap: 14px;
    box-shadow: 0 2px 16px rgba(0,0,0,.06);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.thm-search-inner:focus-within {
    border-color: var(--red);
    box-shadow: 0 2px 20px rgba(200,16,46,.10);
}
.thm-search-icon { color: #bbb; display: flex; align-items: center; flex-shrink: 0; }
.thm-search-input {
    flex: 1; border: none !important; outline: none !important; box-shadow: none !important;
    font-size: 1rem; background: transparent !important;
    color: var(--black) !important; font-family: var(--font);
    letter-spacing: .01em;
    -webkit-text-fill-color: var(--black) !important;
    caret-color: var(--black) !important;
}
.thm-search-input:focus,
.thm-search-input:focus-visible,
.thm-search-input:active,
.thm-search-input:hover {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: var(--black) !important;
    -webkit-text-fill-color: var(--black) !important;
    background: transparent !important;
}
/* Some themes force white/invisible text via autofill styles — override those too */
.thm-search-input:-webkit-autofill,
.thm-search-input:-webkit-autofill:hover,
.thm-search-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--black) !important;
    -webkit-box-shadow: 0 0 0px 1000px var(--white) inset !important;
    transition: background-color 9999s ease-in-out 0s;
}
.thm-search-input::placeholder { color: #c0c0c0; }
.thm-search-clear {
    background: var(--cream); border: none; cursor: pointer;
    color: var(--muted); padding: 4px; display: none; align-items: center;
    border-radius: 50%; width: 24px; height: 24px; justify-content: center;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}
.thm-search-clear:hover { background: var(--cream-dark); color: var(--black); }
.thm-search-clear.visible { display: flex; }

/* Search divider between icon and input */
.thm-search-divider {
    width: 1px; height: 20px; background: var(--border); flex-shrink: 0;
}

.thm-search-results {
    position: absolute; top: calc(100% + 10px); left: 0; right: 0;
    background: var(--white);
    border-radius: 20px;
    border: 2px solid var(--border);
    box-shadow: 0 16px 48px rgba(0,0,0,.12);
    overflow: hidden;
    max-height: 360px; overflow-y: auto; z-index: 300;
}
.thm-search-results[hidden] { display: none; }
.thm-search-result-item {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 18px; cursor: pointer;
    border: none; border-bottom: 1px solid var(--cream);
    width: 100%; background: none; font-family: var(--font); text-align: left;
    color: var(--black) !important;
    transition: background var(--transition);
}
.thm-search-result-item:last-child { border-bottom: none; }
.thm-search-result-item:hover,
.thm-search-result-item:focus,
.thm-search-result-item:active {
    background: var(--cream) !important;
    color: var(--black) !important;
}
.thm-search-result-img {
    width: 50px; height: 50px; flex-shrink: 0;
    object-fit: contain; background: var(--cream); border-radius: 10px; padding: 4px;
}
.thm-search-result-name {
    font-size: .9375rem; font-weight: 700;
    color: var(--black) !important;
}
.thm-search-result-meta {
    font-size: .8rem; color: var(--muted) !important; margin-top: 2px; display: flex; gap: 8px;
}
.thm-search-no-results  { padding: 28px; text-align: center; color: var(--muted); font-size: .9rem; }

/* ── Category filter tabs ─────────────────────────────── */
.thm-category-nav {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 32px; padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}
.thm-cat-btn {
    padding: 8px 18px;
    border: 2px solid var(--border);
    border-radius: var(--pill);
    background: var(--white);
    color: var(--black);
    font-size: .875rem; font-weight: 700; font-family: var(--font);
    cursor: pointer; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 7px;
    box-shadow: none;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.thm-cat-btn:hover {
    border-color: var(--cream-dark) !important;
    color: var(--black) !important;
    background: var(--cream) !important;
    box-shadow: none !important;
}
.thm-cat-btn.active {
    background: var(--red);
    border-color: var(--red);
    color: var(--white);
    box-shadow: none;
}
.thm-cat-count {
    font-size: .7rem; font-weight: 700; padding: 1px 7px;
    border-radius: var(--pill); background: rgba(0,0,0,.10);
    line-height: 1.6;
}
.thm-cat-btn.active .thm-cat-count { background: rgba(255,255,255,.22); }

/* ── Section headers ──────────────────────────────────── */
.thm-category-section { margin-bottom: 52px; }
.thm-category-section.thm-hidden { display: none; }

.thm-section-header {
    display: flex; align-items: center;
    justify-content: space-between; gap: 12px;
    margin-bottom: 20px; padding-bottom: 12px;
    border-bottom: 3px solid var(--red);
}
.thm-section-title {
    font-size: 1.15rem; font-weight: 800; margin: 0; color: var(--black);
    letter-spacing: .03em; text-transform: uppercase;
    display: flex; align-items: center; gap: 10px;
}
.thm-section-count {
    font-size: .7rem; color: var(--muted); font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em; white-space: nowrap;
}
/* Small rounded accent swatch preceding a category heading — colour is set
   inline per-category via THM_Menu_Data::category_color() */
.thm-section-accent {
    width: 14px; height: 14px; border-radius: 5px; flex-shrink: 0;
    box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.06);
}
.thm-page-title { display: flex; align-items: center; gap: 12px; }
.thm-page-title-accent { width: 18px; height: 18px; border-radius: 6px; }

/* ── Grid — 4 columns default ─────────────────────────── */
.thm-grid { display: grid; gap: 18px; }
.thm-grid-2 { grid-template-columns: repeat(2, 1fr); }
.thm-grid-3 { grid-template-columns: repeat(3, 1fr); }
.thm-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) {
    .thm-grid-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
    .thm-grid-3, .thm-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
    .thm-grid-2, .thm-grid-3, .thm-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 360px) {
    .thm-grid-2, .thm-grid-3, .thm-grid-4 { grid-template-columns: 1fr; }
}

/* ── Item Card ────────────────────────────────────────── */
.thm-item-card {
    background: var(--white);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    display: flex; flex-direction: column;
    cursor: pointer;
    border: 1.5px solid var(--border);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.thm-item-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--cream-dark);
}
.thm-item-card.thm-hidden { display: none; }

/* Media — pastel category-accent background (inline style) behind the image,
   with floating price/calorie badges on top, matching the reference design. */
.thm-card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: var(--card-radius) var(--card-radius) 0 0;
}
.thm-card-image {
    width: 100%; height: 100%;
    object-fit: contain; object-position: center;
    display: block; padding: 18px;
    transition: transform .3s ease;
}
.thm-item-card:hover .thm-card-image { transform: scale(1.06); }
.thm-card-image-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
}
.thm-card-image-placeholder svg { opacity: .18; }

.thm-media-badge {
    position: absolute; top: 10px; z-index: 1;
    font-size: .8rem; font-weight: 800; line-height: 1;
    padding: 7px 12px; border-radius: var(--pill);
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.thm-media-badge-price {
    left: 10px;
    background: var(--white);
    color: var(--red);
}
.thm-media-badge-cal {
    right: 10px;
    background: #e7f3ea; color: #1e7d4b; /* default / low tier */
}
.thm-media-badge-cal[data-tier="mid"]  { background: #fdead0; color: #a05a06; }
.thm-media-badge-cal[data-tier="high"] { background: #fbe0dc; color: #a3271b; }

/* Card body */
.thm-card-body {
    padding: 14px 14px 16px;
    display: flex; flex-direction: column; flex: 1; gap: 10px;
}
.thm-card-title {
    font-size: .9375rem; font-weight: 800;
    color: var(--black); margin: 0; line-height: 1.3;
}

/* Pill-style size buttons — used in the modal / [th_item] detail view */
.thm-size-buttons {
    display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 4px;
}
.thm-size-buttons .thm-size-btn {
    padding: 4px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--pill);
    background: var(--white);
    color: var(--black);
    font-size: .8rem; font-weight: 700; font-family: var(--font);
    cursor: pointer; line-height: 1.5;
    box-shadow: none;
    transition: border-color var(--transition), background var(--transition), color var(--transition);
}
.thm-size-buttons .thm-size-btn:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--white);
}
.thm-size-buttons .thm-size-btn.active {
    background: var(--red);
    border-color: var(--red);
    color: var(--white);
}
.thm-size-buttons-lg .thm-size-btn {
    padding: 7px 20px; font-size: .9rem;
}

/* Size rows — one row per size, showing label / cal / price at a glance */
.thm-size-rows {
    display: flex; flex-direction: column; gap: 6px;
}
.thm-size-btn.thm-size-row {
    display: flex; align-items: center; gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--cream);
    cursor: pointer;
    font-family: var(--font);
    text-align: left;
    box-shadow: none;
    transition: border-color var(--transition), background var(--transition);
}
.thm-size-btn.thm-size-row:hover {
    border-color: var(--red);
    background: var(--cream) !important;
}
.thm-size-btn.thm-size-row.active {
    background: var(--white);
    border-color: var(--red);
}
.thm-size-row-label {
    font-size: .7rem; font-weight: 800; color: var(--muted);
    letter-spacing: .04em; text-transform: uppercase;
}
.thm-size-row.active .thm-size-row-label { color: var(--black); }
.thm-size-row-cal {
    font-size: .72rem; color: var(--muted); margin-left: auto;
}
.thm-size-row-price {
    font-size: .875rem; font-weight: 800; color: var(--black);
    font-variant-numeric: tabular-nums; min-width: 54px; text-align: right;
}

/* "View Details" link-button pinned to the bottom of the card */
.thm-card-view-details {
    display: flex; align-items: center; justify-content: center; gap: 5px;
    margin-top: auto;
    padding: 9px 10px 0;
    border: none; border-top: 1px solid var(--border);
    background: none !important;
    color: var(--red) !important;
    font-family: var(--font);
    font-size: .78rem; font-weight: 800;
    letter-spacing: .05em; text-transform: uppercase;
    cursor: pointer;
    box-shadow: none !important;
    transition: color var(--transition), opacity var(--transition);
}
.thm-card-view-details:hover,
.thm-card-view-details:focus,
.thm-card-view-details:active {
    background: none !important;
    color: var(--red) !important;
    opacity: .68;
    box-shadow: none !important;
    outline: none !important;
}
.thm-card-view-details svg { flex-shrink: 0; margin-top: 1px; }

/* ── Modal ────────────────────────────────────────────── */
.thm-modal {
    position: fixed; inset: 0; z-index: 99999;
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.thm-modal[hidden] { display: none !important; }

.thm-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
}
.thm-modal-dialog {
    position: relative; background: var(--white);
    border-radius: 20px; box-shadow: var(--modal-shadow);
    max-width: 640px; width: 100%; max-height: 88vh; overflow-y: auto;
    animation: thmIn .18s ease;
    z-index: 1;
}
@keyframes thmIn {
    from { opacity: 0; transform: scale(.95) translateY(12px); }
    to   { opacity: 1; transform: none; }
}
.thm-modal-close {
    position: sticky !important; top: 14px !important; float: right !important;
    margin: 14px 14px 0 0 !important;
    width: 36px !important; height: 36px !important; min-width: 0 !important;
    padding: 0 !important;
    background: var(--cream) !important;
    border: 1.5px solid var(--border) !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    color: var(--black) !important;
    z-index: 2 !important;
    box-shadow: none !important;
    line-height: 1 !important;
    transition: background var(--transition), border-color var(--transition) !important;
}
.thm-modal-close:hover,
.thm-modal-close:focus,
.thm-modal-close:active {
    background: var(--cream-dark) !important;
    border-color: #bbb !important;
    color: var(--black) !important;
    box-shadow: none !important;
    outline: none !important;
}
.thm-modal-close svg {
    display: block !important;
    width: 16px !important; height: 16px !important;
    flex-shrink: 0 !important;
}
.thm-modal-body { padding: 0 24px 32px; clear: both; }
.thm-modal-loading {
    display: flex; flex-direction: column; align-items: center;
    padding: 60px; gap: 16px; color: var(--muted); font-size: .9rem;
}
.thm-spinner {
    width: 28px; height: 28px;
    border: 2.5px solid var(--border); border-top-color: var(--red);
    border-radius: 50%; animation: thmSpin .65s linear infinite;
}
@keyframes thmSpin { to { transform: rotate(360deg); } }

/* ── Item Detail (modal + [th_item]) ──────────────────── */
.thm-item-full-image-wrap {
    width: 100%; background: var(--white);
    border-radius: 14px; aspect-ratio: 4/3;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; margin-bottom: 20px;
}
.thm-item-full-image {
    width: 100%; height: 100%;
    object-fit: contain; padding: 16px; display: block;
}
.thm-item-full-breadcrumb {
    font-size: .7rem; color: var(--muted); margin-bottom: 5px;
    text-transform: uppercase; letter-spacing: .07em; font-weight: 700;
}
.thm-item-full-title {
    font-size: 1.4rem; font-weight: 800; margin: 0 0 8px;
    color: var(--black); line-height: 1.2;
}
.thm-item-full-desc {
    font-size: .875rem; color: var(--muted); margin: 0 0 14px; line-height: 1.65;
}
.thm-item-full-badges {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 12px 0 18px;
}
.thm-badge-price-lg {
    font-size: 1.6rem; font-weight: 800;
    color: var(--red); font-variant-numeric: tabular-nums; line-height: 1;
}
.thm-badge-cal-lg {
    font-size: .875rem; font-weight: 700;
    padding: 6px 14px; border-radius: var(--pill);
    background: #e7f3ea; color: #1e7d4b;
}
.thm-badge-cal-lg[data-tier="mid"]  { background: #fdead0; color: #a05a06; }
.thm-badge-cal-lg[data-tier="high"] { background: #fbe0dc; color: #a3271b; }
.thm-modal-divider {
    border: none; border-top: 2px solid var(--cream-dark); margin: 18px 0;
}

/* Nutrition panel */
.thm-nutrition-section {
    border-radius: 14px; overflow: hidden; border: 1.5px solid var(--border);
}
.thm-nutrition-header {
    padding: 12px 18px; background: var(--cream);
    border-bottom: 1.5px solid var(--border);
}
.thm-nutrition-title { font-size: .9375rem; font-weight: 800; margin: 0 0 2px; }
.thm-nutrition-note  { font-size: .7rem; color: var(--muted); margin: 0;
    text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.thm-nutrition-grid { background: var(--white); }
.thm-nutrition-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 9px 18px; border-bottom: 1px solid var(--cream);
}
.thm-nutrition-row:last-child { border-bottom: none; }
.thm-nutrition-highlight {
    background: var(--black); color: var(--white); padding: 12px 18px;
}
.thm-nutrition-label { font-size: .875rem; color: var(--muted); }
.thm-nutrition-highlight .thm-nutrition-label { color: #bbb; font-weight: 500; }
.thm-nutrition-value { font-weight: 700; font-size: .875rem; font-variant-numeric: tabular-nums; }
.thm-nutrition-highlight .thm-nutrition-value { color: var(--white); }

/* Allergens */
.thm-allergens {
    padding: 12px 18px; background: var(--cream); border-top: 1.5px solid var(--border);
}
.thm-allergens-title {
    font-size: .7rem; font-weight: 800; margin: 0 0 7px; color: var(--muted);
    text-transform: uppercase; letter-spacing: .07em;
}
.thm-allergens-list { display: flex; flex-wrap: wrap; gap: 6px; }
.thm-allergen-badge {
    padding: 3px 11px; background: var(--white);
    border: 1.5px solid var(--border); border-radius: var(--pill);
    font-size: .78rem; font-weight: 700; color: var(--black);
}

/* Standalone [th_item] */
.thm-single-item .thm-item-full-image-wrap { max-width: 360px; margin: 0 auto 24px; aspect-ratio: 1; }
.thm-single-item .thm-item-full-title { font-size: 1.9rem; }

/* Error */
.thm-error {
    background: #fff0f2; border: 1.5px solid #f5c6cc; color: #7d0010;
    padding: 12px 16px; border-radius: 10px; font-size: .9rem;
}
