/* Pricelist Mobile-First Design */

:root {
    /* Use global theme colors */
    --pl-primary-color: var(--e-global-color-primary, #093854);
    --pl-primary: var(--e-global-color-text, #1A1A1A);
    --pl-secondary: rgba(26, 26, 26, 0.6); /* Lighter version of text */
    --pl-accent: var(--e-global-color-accent, #E2222B);
    --pl-bg-hover: rgba(9, 56, 84, 0.05); /* Blueish hover */
    --pl-bg-white: var(--e-global-color-c951cd8, #FFFFFF);
    --pl-highlight: var(--e-global-color-2b3a294, #FFEAB8);
    --pl-border: rgba(26, 26, 26, 0.1); /* Light border using text color */
    --pl-header-bg: rgba(9, 56, 84, 0.1); /* Semitransparent blue from primary */
    --pl-spacing-sm: 12px;
    --pl-spacing-md: 20px;
    --pl-spacing-lg: 32px;
    --pl-font-base: 16px;
    --pl-indent: 16px;
    --pl-radius: 4px;
}

.linove-pricelist {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 var(--pl-spacing-sm) var(--pl-spacing-md) var(--pl-spacing-sm);
    font-family: inherit;
    color: var(--pl-primary);
    box-sizing: border-box;
    flex-shrink: 0; /* Prevent flex shrinking */
}

.linove-pricelist * {
    box-sizing: border-box;
}

/* --- Search Section --- */
.pricelist-search {
    min-width: 100%;
    margin-bottom: 0px;
    padding: 16px 0;
    width: 100%;
    position: sticky;
    top: 64px; /* Account for header height */
    z-index: 97;
    background-color: var(--pl-bg-white);
    transition: box-shadow 0.3s ease;
}

.pricelist-search.is-sticky {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.pricelist-search-wrapper {
    position: relative;
    width: 100%;
}

.pricelist-search-input {
    width: 100% !important;
    padding: 12px 20px !important;
    padding-right: 48px !important; /* Space for clear button */
    border: 2px solid var(--pl-primary-color) !important;
    border-radius: 0 !important; /* No border-radius to match search page */
    font-family: inherit !important;
    font-size: 16px !important;
    color: var(--pl-primary) !important;
    background-color: var(--pl-bg-white) !important;
    transition: border-color 0.3s ease !important;
    outline: none !important;
    box-sizing: border-box !important;
}

.pricelist-search-input:focus {
    border-color: var(--pl-accent) !important;
    outline: none !important;
}

.pricelist-search-input::placeholder {
    color: var(--pl-secondary);
}

.pricelist-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--pl-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background-color 0.2s ease;
    border-radius: 50%;
    width: 32px;
    height: 32px;
}

.pricelist-search-clear:hover {
    color: var(--pl-accent);
    background-color: rgba(226, 34, 43, 0.1);
}

.pricelist-search-clear:focus {
    outline: 2px solid var(--pl-accent);
    outline-offset: 2px;
}

.pricelist-search-clear[hidden] {
    display: none;
}

.pricelist-search-clear svg {
    width: 14px;
    height: 14px;
    pointer-events: none;
}

.pricelist-featured-chips {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: var(--pl-spacing-lg);
    padding: 0 var(--pl-spacing-sm);
    align-items: center;
}

.pricelist-chips-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--pl-secondary);
    display: block;
    width: 100%;
    text-align: center;
}

.pricelist-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.pricelist-chip {
    background: var(--pl-bg-white);
    border: 1px solid var(--pl-primary-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--pl-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Truncate chip text on mobile only (max 24 characters equivalent) */
@media (max-width: 767px) {
    .pricelist-chip {
        max-width: 200px; /* Approximately 24 characters at 14px font size */
        display: inline-block;
    }
}

.pricelist-chip:hover,
.pricelist-chip:focus,
.pricelist-chip.active {
    background-color: var(--pl-accent) !important;
    color: var(--pl-bg-white) !important;
    border-color: var(--pl-accent) !important;
}

/* --- Results List --- */
.pricelist-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
}

/* --- Categories --- */
.pricelist-category-card {
    background: var(--pl-bg-white);
    border: 1px solid var(--pl-border);
    border-radius: 16px; /* Match other cards in project */
    margin-top: 8px;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    box-shadow: 0 4px 20px rgba(9, 56, 84, 0.08); /* Match other cards */
    overflow: hidden; /* Ensure border-radius works */
}

/* Ensure nested cards also look like cards */
.pricelist-category-card .pricelist-category-card {
    border: 1px solid var(--pl-border);
    border-radius: 12px; /* Slightly smaller radius for nested cards */
    margin-top: 12px;
    margin-bottom: 12px;
    width: calc(100% - 24px);
    min-width: 0;
    max-width: calc(100% - 24px);
    margin-left: 12px;
    margin-right: 12px;
    box-shadow: 0 2px 12px rgba(9, 56, 84, 0.06); /* Lighter shadow for nested */
}

.pricelist-category-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px var(--pl-spacing-sm);
    cursor: pointer;
    user-select: none;
    min-height: 54px;
    background-color: rgba(9, 56, 84, 0.05); /* Very transparent primary color */
    transition: background-color 0.2s ease;
    gap: 12px;
}

.pricelist-category-header-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.pricelist-category-header:hover {
    background-color: rgba(9, 56, 84, 0.08); /* Slightly more opaque on hover */
}

.pricelist-category-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

.pricelist-category-note {
    font-size: 0.7rem;
    color: var(--pl-secondary);
    font-style: italic;
    line-height: 1.4;
    opacity: 0.8;
    margin-top: 2px;
}

/* Toggle Icon */
.pricelist-toggle {
    background: none;
    border: none;
    padding: 8px;
    margin-left: 12px;
    cursor: pointer;
    color: var(--pl-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.pricelist-toggle:hover {
    background-color: var(--pl-primary-color, #093854);
    color: var(--pl-bg-white, #FFFFFF);
}

.pricelist-toggle svg {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
}

.pricelist-toggle svg path {
    transition: stroke 0.2s ease;
    stroke: var(--pl-secondary); /* Gray arrow by default */
}

.pricelist-toggle:hover svg path {
    stroke: var(--pl-bg-white, #FFFFFF); /* White arrow on hover when button has primary background */
}

/* Expanded state rotation */
.pricelist-toggle[aria-expanded="true"] svg {
    transform: rotate(0deg);
}
.pricelist-toggle[aria-expanded="false"] svg {
    transform: rotate(-90deg);
}

/* Category Content */
.pricelist-category-content {
    display: block;
    overflow: hidden;
}

.pricelist-category-content.collapsed {
    display: none;
}

/* --- Service Items --- */
.pricelist-service-item {
    display: flex;
    flex-direction: column;
    padding: 12px var(--pl-spacing-sm);
    gap: 8px;
    transition: background-color 0.2s ease;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
}

.pricelist-service-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

/* Add subtle border to all service items */
.pricelist-category-content .pricelist-item.pricelist-service .pricelist-service-item {
    border-bottom: 1px solid var(--pl-border);
}

/* Remove border from last service item in each category content */
.pricelist-category-content .pricelist-item.pricelist-service:last-of-type .pricelist-service-item,
.pricelist-category-content .pricelist-item.pricelist-service:last-child .pricelist-service-item {
    border-bottom: none;
}

.pricelist-service-item:hover {
    background-color: var(--pl-bg-hover);
}

.pricelist-service-info {
    flex: 1;
    min-width: 0; /* Enable truncation if needed */
}

.pricelist-service-name {
    font-size: 1rem;
    color: var(--pl-primary);
    line-height: 1.4;
    word-break: break-word;
}

.pricelist-service-order {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    margin-top: 4px;
}

@media (min-width: 768px) {
    .pricelist-service-order {
        align-items: flex-end;
    }
}

.pricelist-service-category {
    font-size: 0.75rem;
    color: var(--pl-secondary);
    font-weight: 400;
    line-height: 1.4;
    margin-top: 2px;
}

.pricelist-service-note {
    font-size: 0.7rem;
    color: var(--pl-secondary);
    font-style: italic;
    line-height: 1.4;
    opacity: 0.8;
}

.pricelist-service-code {
    font-size: 0.85rem;
    color: var(--pl-secondary);
    margin-right: 8px;
    font-family: monospace;
}

.pricelist-service-price {
    font-weight: 600;
    color: var(--pl-primary);
    font-size: 1.1rem;
    white-space: nowrap;
}

.pricelist-price-empty {
    font-size: 0.9rem;
    color: var(--pl-secondary);
    font-style: italic;
    font-weight: normal;
}

.pricelist-service-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background-color: var(--pl-primary-color) !important;
    color: var(--pl-bg-white) !important;
    text-decoration: none !important;
    border-radius: 0;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--global-font);
    text-align: center;
    transition: background-color 0.3s ease, color 0.3s ease;
    width: auto;
    min-width: 110px;
    border: 0;
    margin: 0;
}

.pricelist-service-link:hover,
.pricelist-service-link:focus,
.pricelist-service-link:active,
.pricelist-service-link:visited {
    background-color: var(--pl-accent);
    color: var(--pl-bg-white);
    text-decoration: none !important;
}

@media (max-width: 767px) {
    .pricelist-service-link {
        font-size: 12px;
        padding: 6px 14px;
        min-width: 100px;
        align-self: center;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (min-width: 768px) {
    .pricelist-service-link {
        align-self: flex-end;
        margin-left: 0;
    }
}

/* --- Hierarchy / Indentation --- */

/* Root Level (Level 0) */
.pricelist-item--level-0 {
    margin-bottom: 8px;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
}

/* Level 1+ (Nested) - Use border and padding instead of heavy margin */
.pricelist-item--level-1 .pricelist-category-content,
.pricelist-item--level-2 .pricelist-category-content,
.pricelist-item--level-3 .pricelist-category-content,
.pricelist-item--level-4 .pricelist-category-content {
    padding-left: 0;
    border-left: none; /* Removed vertical line */
    margin-left: 0;
    width: 100%;
}

/* Adjust nested items alignment - removed to keep styling consistent */
/* 
.pricelist-item--level-1 .pricelist-category-header,
.pricelist-item--level-1 .pricelist-service-item {
    padding-left: 8px;
    width: 100%;
}
*/

/* Hidden State for Filtering */
.pricelist-item.hidden {
    display: none !important;
}

/* Highlights */
mark {
    background-color: var(--pl-highlight);
    color: var(--pl-primary);
    padding: 0 2px;
    border-radius: 2px;
}

/* --- Empty State --- */
.pricelist-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--pl-secondary);
    background: var(--pl-bg-hover);
    border-radius: 8px;
}

/* --- Tablet / Desktop (min-width: 768px) --- */
@media (min-width: 768px) {
    .linove-pricelist {
        padding: 0px 20px 40px 20px;
        width: 100%;
        max-width: 1000px;
    }

    .pricelist-search {
        padding: 16px 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        top: 78px; /* Slightly more space on desktop for larger headers */
    }
    
    .pricelist-search-wrapper {
        max-width: 600px;
        width: 100%;
    }
    
    .pricelist-search-input {
        /* Max width handled by wrapper */
    }

    .pricelist-featured-chips {
        justify-content: center;
        padding: 0;
    }

    .pricelist-service-item {
        padding: 16px 24px;
    }

    .pricelist-category-header {
        padding: 16px 24px;
    }

    .pricelist-service-link {
        margin-left: 20px;
    }

    /* Better indentation on desktop */
    :root {
        --pl-indent: 24px;
    }

    /* Root headers bigger */
    .pricelist-item--level-0 > .pricelist-category-card > .pricelist-category-header .pricelist-category-title {
        font-size: 1.5rem;
    }
}
