.trm-menu-wrapper {
    --trm-gap: 24px;
    --trm-font: Lato, sans-serif;
    background: var(--trm-bg);
    padding: 32px;
    border-radius: 24px;
    color: var(--trm-description);
    font-family: var(--trm-font) !important;
    box-shadow: 0 30px 60px rgba(33, 18, 11, 0.08);
    line-height: 1.5;
    width: 100%;
    box-sizing: border-box;
}

.trm-menu-wrapper * {
    box-sizing: border-box;
    font-family: var(--trm-font) !important;
}

.trm-logo {
    margin-bottom: 12px;
}

.trm-logo--left {
    text-align: left;
}

.trm-logo--right {
    text-align: right;
}

.trm-menu-currency-notice {
    text-align: center;
    font-style: italic;
    font-size: 13px;
    margin: -16px 0 24px;
    color: var(--trm-description);
}

.trm-menu-columns {
    display: grid;
    gap: var(--trm-gap);
    width: 100%;
    box-sizing: border-box;
}

.trm-columns-1 {
    grid-template-columns: 1fr;
}

.trm-columns-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.trm-columns-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.trm-columns-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ===========================================
   CATEGORY TABS
   =========================================== */

.trm-category-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.trm-category-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--trm-description);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s ease;
    font-family: var(--trm-font) !important;
    position: relative;
}

.trm-category-tab:hover {
    color: var(--trm-accent);
    background: rgba(197, 143, 92, 0.08);
    border-radius: 8px 8px 0 0;
}

.trm-category-tab.active {
    color: #ffffff;
    background: var(--trm-accent);
    border-bottom-color: transparent;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 4px 12px rgba(197, 143, 92, 0.2);
}

.trm-menu-columns > .trm-category {
    display: none;
}

.trm-menu-columns > .trm-category:first-child {
    display: block;
}

/* ===========================================
   BASE CATEGORY & ITEM STRUCTURE
   =========================================== */

.trm-category {
    background: var(--trm-surface);
    border-radius: 18px;
    padding: 20px;
    border: 1px solid var(--trm-separator);
    width: 100%;
    box-sizing: border-box;
}

/* Hide category titles in main layouts - they only show in tabs */
.trm-layout-classic .trm-category > .trm-category-title,
.trm-layout-grid .trm-category > .trm-category-title {
    display: none;
}

.trm-category-title {
    font-size: var(--trm-category-size);
    font-family: var(--trm-font) !important;
    color: var(--trm-heading);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--trm-separator);
}

.trm-category-description {
    margin-top: 0;
    margin-bottom: 12px;
}

/* Base item structure */
.trm-item {
    display: flex;
    flex-direction: row;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--trm-separator);
    position: relative;
    align-items: start;
    width: 100%;
}

.trm-item-body {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.trm-item-image {
    display: inline-block;
    overflow: hidden;
    flex-shrink: 0;
    width: 90px;
    height: 90px;
    border-radius: 12px;
}

.trm-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
}

/* Image shape variations */
.trm-shape-rounded {
    border-radius: 12px !important;
}

.trm-shape-rounded img {
    border-radius: 12px !important;
}

.trm-shape-circle {
    border-radius: 50% !important;
    width: 90px !important;
    height: 90px !important;
}

.trm-shape-circle img {
    border-radius: 50% !important;
}

.trm-shape-squircle {
    border-radius: 24px !important;
}

.trm-shape-squircle img {
    border-radius: 24px !important;
}

/* Item content */
.trm-item-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    width: 100%;
}

.trm-price-left {
    flex-direction: row-reverse;
    justify-content: flex-start;
    gap: 6px;
}

.trm-price-inline {
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}

.trm-price-inline .trm-item-title {
    display: inline-flex;
    gap: 8px;
    align-items: baseline;
}

.trm-item-title {
    font-size: var(--trm-item-title-size);
    font-family: var(--trm-font) !important;
    color: var(--trm-title);
    margin: 0;
    line-height: 1.2;
    flex: 1;
    word-break: break-word;
}

.trm-item-price {
    font-size: var(--trm-price-size);
    color: var(--trm-price);
    font-weight: 600;
    margin-left: 6px;
}

.trm-price-inline .trm-item-price {
    margin-left: 8px;
}

.trm-item-description {
    font-size: var(--trm-description-size);
    margin-top: 6px;
    line-height: 1.4;
}

.trm-item-tags {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.trm-tag {
    background: rgba(197, 143, 92, 0.2);
    color: var(--trm-heading);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.trm-recommended {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(120deg, var(--trm-accent), #f2c9a3);
    color: #ffffff;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    line-height: 1;
}

/* ===========================================
   COLUMN LAYOUTS - Driven by CSS Variables
   Uses 12-column grid system with responsive breakpoints (tlp-food-menu pattern)
   =========================================== */

/* =========================================================
   TRM Responsive Columns (Grid + CSS variables + Elementor preview)
   ========================================================= */

/* Default active columns */
.trm-menu-wrapper {
  --trm-cols-active: var(--trm-cols-desktop, 1);
}

/* Real device breakpoints */
@media (max-width: 1024px) {
  .trm-menu-wrapper { --trm-cols-active: var(--trm-cols-tablet, 1); }
}
@media (max-width: 767px) {
  .trm-menu-wrapper { --trm-cols-active: var(--trm-cols-mobile, 1); }
}

/* Elementor editor responsive preview (not always a real viewport) */
.elementor-device-tablet .trm-menu-wrapper {
  --trm-cols-active: var(--trm-cols-tablet, 1) !important;
}
.elementor-device-mobile .trm-menu-wrapper {
  --trm-cols-active: var(--trm-cols-mobile, 1) !important;
}

/* The actual columns */
.trm-items {
  display: grid;
  grid-template-columns: repeat(var(--trm-cols-active, 1), minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}

/* Base item structure (Visual Card) */
.trm-item {
    position: relative;
    display: flex;
    flex-direction: row;
    gap: 16px;
    height: 100%; /* Ensure cards match height in row */
}

.trm-item .trm-item-body {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.trm-item-tags {
    margin-top: auto;
    padding-top: 8px;
}



/* ===========================================
   CLASSIC LAYOUT
   =========================================== */

/* No special overrides needed - uses base styles */

/* ===========================================
   GRID LAYOUT (Card Style)
   =========================================== */

.trm-layout-grid .trm-category {
    background: transparent;
    border: none;
    padding: 0;
}

.trm-layout-grid .trm-item {
    background: var(--trm-surface);
    border-radius: 16px;
    border: 1px solid var(--trm-separator);
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: 180px;
    border-bottom: none !important;
}

.trm-layout-grid .trm-item-image {
    order: -1;
    width: 100%;
    height: 160px;
    margin-bottom: 12px;
    border-radius: 12px;
}

.trm-layout-grid .trm-item-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
}

/* Circle images in grid - side-by-side layout */
.trm-layout-grid .trm-shape-circle ~ .trm-item-image {
    width: 90px;
    height: 90px;
    margin-bottom: 0;
    margin-right: 16px;
    flex-shrink: 0;
    align-self: flex-start;
}

.trm-layout-grid .trm-item:has(.trm-shape-circle) {
    flex-direction: row;
    align-items: stretch;
}

.trm-layout-grid .trm-item:has(.trm-shape-circle) .trm-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.trm-layout-grid .trm-item-tags {
    justify-content: flex-start;
    margin-top: auto;
    padding-top: 8px;
}

/* ===========================================
   SEPARATOR STYLE VARIATIONS (Apply to all layouts)
   =========================================== */

/* Dotted Separator */
.trm-separator-dots .trm-item,
.trm-separator-dots .trm-category-title {
    border-bottom-style: dotted;
}

/* No Separator */
.trm-separator-none .trm-item,
.trm-separator-none .trm-category-title {
    border-bottom: none !important;
}

.trm-separator-none .trm-items.trm-cols-2 .trm-item,
.trm-separator-none .trm-items.trm-cols-3 .trm-item,
.trm-separator-none .trm-items.trm-cols-4 .trm-item {
    border-bottom: none !important;
}

/* ===========================================
   RESPONSIVE DESIGN
   
   Breakpoints:
   - Desktop: 1025px and above
   - Tablet: 768px - 1024px
   - Mobile: 0 - 767px (phones and small devices)
   =========================================== */

/* Desktop & Tablet Base (1025px+) */
.trm-menu-wrapper {
    max-width: 100%;
    width: 100%;
}

/* ============================================
   TABLET LANDSCAPE & MEDIUM SCREENS (max-width: 1024px)
   ============================================ */
@media screen and (max-width: 1024px) {
    .trm-menu-wrapper {
        padding: 24px;
    }

    .trm-menu-columns {
        gap: 20px;
    }
    
    .trm-items {
        gap: 16px;
    }
}

/* ============================================
   MOBILE PHONES (max-width: 767px) - PRIMARY MOBILE FIX
   ============================================ */
@media screen and (max-width: 767px) {
    .trm-menu-wrapper {
        padding: 16px;
        border-radius: 16px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }

    .trm-menu-columns {
        width: 100%;
        box-sizing: border-box;
        grid-template-columns: 1fr !important;
    }

    .trm-category {
        width: 100%;
        box-sizing: border-box;
        padding: 12px;
        border-radius: 12px;
    }

    .trm-items {
        width: 100%;
        box-sizing: border-box;
        grid-template-columns: 1fr !important;
    }

    /* Ensure menu title scales down on mobile */
    .trm-menu-title {
        font-size: clamp(20px, 5vw, 28px) !important;
        line-height: 1.2;
        word-break: break-word;
    }

    /* ---- CATEGORY TABS ---- */
    .trm-category-tabs {
        display: flex;
        gap: 6px;
        margin-bottom: 24px;
        padding-bottom: 8px;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        overflow-y: hidden;
        overflow-x: hidden;
    }

    .trm-category-tab {
        white-space: nowrap;
        padding: 8px 14px;
        font-size: 13px;
        flex-shrink: 0;
        background: var(--trm-accent);
        color: #fff;
        border-radius: 999px;
        border: none;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.25s ease;
        font-family: var(--trm-font) !important;
    }

    .trm-category-tab:hover {
        transform: none;
        opacity: 0.9;
    }

    .trm-category-tab.active {
        background: var(--trm-heading);
        color: #fff;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }

    /* ---- ITEMS GRID ---- */
    .trm-items {
        gap: 12px;
    }

    /* ---- ITEM CARDS ---- */
    .trm-item {
        display: grid;
        grid-template-columns: 65px 1fr;
        gap: 12px;
        padding: 12px 0;
        border-bottom: 1px solid var(--trm-separator);
        align-items: flex-start;
        width: 100%;
        min-width: 0;
    }

    /* Ensure item body takes full remaining width */
    .trm-item-body {
        display: flex;
        flex-direction: column;
        width: 100%;
        min-width: 0;
    }

    .trm-item-image {
        width: 65px;
        height: 65px;
        flex-shrink: 0;
        border-radius: 8px;
    }

    .trm-item-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: inherit;
    }

    /* ---- TEXT SCALING ---- */
    .trm-item-header {
        display: flex;
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
        width: 100%;
        min-width: 0;
    }

    .trm-item-title {
        font-size: 15px !important;
        line-height: 1.3;
        word-break: break-word;
        margin: 0;
        flex: 1;
        font-family: var(--trm-font) !important;
    }

    .trm-item-price {
        font-size: 14px !important;
        margin-left: 0;
        margin-top: 2px;
        align-self: flex-start;
    }

    .trm-item-description {
        font-size: 12px;
        margin-top: 4px;
        line-height: 1.3;
        word-break: break-word;
        font-family: var(--trm-font) !important;
    }

    /* ---- TAGS ---- */
    .trm-item-tags {
        margin-top: 6px;
        gap: 4px;
        padding-top: 4px;
    }

    .trm-tag {
        padding: 3px 8px;
        font-size: 11px;
        font-family: var(--trm-font) !important;
    }

    .trm-recommended {
        padding: 3px 8px;
        font-size: 11px;
    }

    /* ---- GRID LAYOUT CARDS ---- */
    .trm-layout-grid .trm-item {
        background: var(--trm-surface);
        border-radius: 12px;
        border: 1px solid var(--trm-separator);
        padding: 12px;
        display: flex;
        flex-direction: column;
        min-height: auto;
        border-bottom: none !important;
        gap: 10px;
    }

    .trm-layout-grid .trm-item-image {
        width: 100%;
        height: 140px;
        margin-bottom: 0;
        border-radius: 8px;
    }

    /* Circular images in grid still work but smaller */
    .trm-layout-grid .trm-item:has(.trm-shape-circle) {
        flex-direction: column;
        align-items: center;
    }

    .trm-layout-grid .trm-shape-circle {
        width: 80px !important;
        height: 80px !important;
    }

    .trm-layout-grid .trm-item-body {
        width: 100%;
    }

    /* ---- CATEGORY TITLE VISIBILITY ---- */
    .trm-category-title {
        font-size: clamp(16px, 4vw, 20px);
        font-family: var(--trm-font) !important;
    }
}

/* ============================================
   SMALL PHONES (max-width: 480px) - EXTRA SMALL SCREENS
   ============================================ */
@media screen and (max-width: 480px) {
    .trm-menu-wrapper {
        padding: 12px;
    }

    .trm-item {
        grid-template-columns: 55px 1fr;
        gap: 10px;
        padding: 10px 0;
    }

    .trm-item-image {
        width: 55px;
        height: 55px;
    }

    .trm-item-title {
        font-size: 14px !important;
        font-family: var(--trm-font) !important;
    }

    .trm-item-price {
        font-size: 13px !important;
    }

    .trm-item-description {
        font-size: 11px;
        font-family: var(--trm-font) !important;
    }

    .trm-category-tab {
        padding: 6px 12px;
        font-size: 12px;
    }

    .trm-layout-grid .trm-item {
        padding: 10px;
    }

    .trm-layout-grid .trm-item-image {
        height: 120px;
    }
}

/* ============================================
   ELEMENTOR PHONE PREVIEW COMPATIBILITY
   Targets Elementor's preview containers
   ============================================ */

/* When rendered in Elementor phone preview (usually ~480px or less) */
.elementor-preview-mobile .trm-menu-wrapper,
.elementor-preview-tablet .trm-menu-wrapper {
    max-width: 100%;
    width: 100%;
}

/* ============================================
   RESPONSIVE GRID SYSTEM - Complete
   All responsive behavior handled via media queries
   ============================================ */
/* Admin Preview Overrides for Columns */
.trm-preview-mode-tablet .trm-menu-wrapper {
  --trm-cols-active: var(--trm-cols-tablet, 1) !important;
}
.trm-preview-mode-mobile .trm-menu-wrapper {
  --trm-cols-active: var(--trm-cols-mobile, 1) !important;
}

/* FINAL SAFEGUARD: Force 1 column on mobile regardless of settings */
/* Added 393px specifically for Tecno Camon 19 and similar viewport sizes */
@media screen and (max-width: 767px), screen and (max-width: 900px) and (max-height: 500px), screen and (device-width: 393px) {
    .trm-items, .trm-menu-columns {
        grid-template-columns: 1fr !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .trm-item {
        width: 100% !important;
        box-sizing: border-box !important;
        max-width: none !important;
    }

    .trm-menu-wrapper {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}
