/*
 * Base theme components (shared with tecnojcuy).
 * Engine 1 printed these rules once per block, scoped to a generated #id.
 * Here they are classes. Load after styles.css and before store.css.
 * Store-specific colors and layout live in store.css.
 */

/* Text and icons */
.t-text {
    font-family: var(--font-body-family);
}

.t-h1,
.t-h2,
.t-h3,
.t-h4,
.t-h5 {
    font-family: var(--font-heading-family);
}

.t-bold {
    font-weight: 700;
}

.t-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

/* Buttons and button-like links. .t-btn is the shape; one modifier picks the look. */
.t-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-family: inherit;
    line-height: 1;
    font-size: 1rem;
    border-radius: var(--button-input-border-radius, 0.375rem);
}

.t-btn--primary {
    padding: 0.75rem 1.125rem;
    background-color: var(--primary-color);
    color: white;
    transition: opacity 0.2s ease;

    &:hover {
        opacity: 0.9;
    }
}

.t-btn--secondary {
    padding: 0.75rem 1.125rem;
    background-color: transparent;
    color: var(--primary-color);
    transition: background-color 0.2s ease;

    &:hover {
        background-color: rgba(0, 0, 0, 0.06);
    }
}

.t-btn--icon {
    padding: 0.75rem;
    background-color: transparent;
    transition: background-color 0.2s ease;

    &:hover {
        background-color: rgba(0, 0, 0, 0.06);
    }
}

.t-btn--bold {
    font-weight: bold;
}

/* <button> elements: loader, cart badge and disabled state (theme.js toggles them) */
.t-button {
    position: relative;

    &:disabled {
        opacity: 0.7;
        cursor: wait;
    }
}

.t-button .t-button__badge {
    position: absolute;
    top: 0;
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0;
    border-radius: 9999px;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

.t-button .t-button__badge[hidden],
.t-button .t-button__loader[hidden] {
    display: none;
}

.t-button .t-button__loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
}

.t-button .t-button__loader svg {
    animation: t-spin 1s linear infinite;
    transform-origin: center;
}

.t-button .t-button__content {
    display: contents;
}

.t-button .t-button__content > * {
    transition: opacity 0.2s ease;
}

.t-button[data-loading='true'] .t-button__content > * {
    opacity: 0;
}

/* Inputs */
.t-input {
    display: block;
    flex: 1;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: var(--button-input-border-radius, 0.375rem);
    background: white;
    color: inherit;
    font-family: inherit;

    &::placeholder {
        color: #9ca3af;
    }

    &:focus {
        outline: 2px solid var(--color-primary, #0000FF);
        outline-offset: 2px;
    }
}

/* Section containers */
.t-section-outer {
    padding: 64px var(--container-horizontal-padding, 8px);
}

.t-section-inner {
    max-width: var(--container-max-width, 1024px);
    margin: 0 auto;
}

.t-section-inner--stack {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.t-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 8px;
    column-gap: 16px;
}

@media (width <= 64rem) {
    .t-section-outer {
        padding: 40px var(--container-horizontal-padding, 8px);
    }

    .t-section-inner--stack {
        gap: 24px;
    }
}

@media (width <= 48rem) {
    .t-section-outer {
        padding: 32px var(--container-horizontal-padding, 8px);
    }

    .t-section-inner--stack {
        gap: 20px;
    }
}

/* Grids */
.t-product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
}

.t-collection-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

@media (width <= 64rem) {
    .t-product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 20px;
    }

    .t-collection-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }
}

@media (width <= 48rem) {
    .t-product-grid,
    .t-collection-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }
}

/* Images. .t-image--cover fills a square box; .t-image--contain keeps the image's own ratio. */
.t-image--cover,
.t-image--contain {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 0;
}

.t-image--cover {
    aspect-ratio: 1 / 1;
}

.t-image--rounded {
    border-radius: var(--product-image-border-radius, 0);
}

.t-image--cover .t-image__img,
.t-image--contain .t-image__img {
    display: block;
    position: relative;
    z-index: 0;
    width: 100%;
    max-width: 100%;
    object-position: center;
    height: 100%;
    object-fit: cover;
}

.t-image--contain .t-image__img {
    height: auto;
    object-fit: contain;
}

/* Stars. The fill width is set inline from the rating. */
.t-stars {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1;
}

.t-stars .t-stars__container {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
    color: var(--color-primary);
}

.t-stars--accent .t-stars__container {
    color: var(--color-accent);
}

.t-stars svg {
    display: block;
    width: 1.125rem;
    height: 1.125rem;
    flex: 0 0 auto;
    fill: currentColor;
    stroke: currentColor;
}

.t-stars--lg svg {
    width: 1.5rem;
    height: 1.5rem;
}

.t-stars--xl svg {
    width: 2rem;
    height: 2rem;
}

.t-stars .t-stars__background,
.t-stars .t-stars__fill {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
}

.t-stars .t-stars__background {
    color: #d1d5db;
}

.t-stars .t-stars__fill {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    color: inherit;
}

.t-stars .t-stars__value {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    text-align: center;
    white-space: nowrap;
}

/* Product and collection cards */
.t-product-card,
.t-collection-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    border-radius: var(--product-image-border-radius, 0);
}

.t-collection-card {
    gap: 10px;
}

.t-product-card__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.t-collection-card__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.t-collection-card__title {
    overflow-wrap: anywhere;
}

.t-product-image {
    display: block;
}

.t-product-card__pricing {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.t-product-compare__value {
    color: #94a3b8;
    text-decoration: line-through;
}

.t-free-shipping {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    background-color: #16a34a;
    color: white;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    width: fit-content;
    line-height: 1;
    text-transform: uppercase;
}

.t-free-shipping .t-icon {
    color: #ffffff;
}

/* Breadcrumbs */
.t-breadcrumbs-section {
    padding: 16px 0;
}

.t-breadcrumbs-section__outer {
    padding: 0 var(--container-horizontal-padding, 8px);
}

.t-breadcrumbs {
    line-height: 1.4;
    color: #6b7280;
    overflow: hidden;
}

.t-breadcrumbs .t-breadcrumbs__list {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.375rem;
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
    overflow: hidden;
}

.t-breadcrumbs .t-breadcrumbs__item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
    flex: 0 1 auto;
    white-space: nowrap;
    overflow: hidden;
}

.t-breadcrumbs .t-breadcrumbs__item:first-child {
    flex-shrink: 0;
}

.t-breadcrumbs .t-breadcrumbs__item:last-child {
    flex: 1 1 auto;
}

.t-breadcrumbs .t-breadcrumbs__link {
    color: var(--color-primary, #0000FF);
    font-weight: 400;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
}

.t-breadcrumbs .t-breadcrumbs__current {
    color: currentColor;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.t-breadcrumbs .t-breadcrumbs__separator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    opacity: 0.55;
    flex: 0 0 auto;
    line-height: 0;
}

/* Collection sort */
.t-collection-sort {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 100%;
    max-width: 16rem;
}

.t-collection-sort select {
    flex: 1;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: var(--button-input-border-radius, 0.375rem);
    background: white;
    color: inherit;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.t-collection-sort select:focus {
    outline: 2px solid var(--color-primary, #0000FF);
    outline-offset: 2px;
}

.t-collection-sort .t-collection-sort__icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: inherit;
    opacity: 0.6;
}

/* Product page: stock, quantity, units sold */
.t-product-stock-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
    max-width: 100%;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.t-product-stock-status[data-stock-tone='success'] {
    color: #15803d;
}

.t-product-stock-status[data-stock-tone='warning'] {
    color: #c2410c;
}

.t-product-stock-status[data-stock-tone='error'] {
    color: #dc2626;
}

.t-product-stock-status[data-stock-tone='neutral'] {
    color: #6b7280;
}

.t-product-quantity {
    display: inline-grid;
    grid-template-columns: 2.75rem minmax(4rem, 1fr) 2.75rem;
    width: min(100%, 10rem);
    min-height: 3rem;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: var(--button-input-border-radius, 0.375rem);
    background: white;
    color: inherit;
}

.t-product-quantity .t-product-quantity__button,
.t-product-quantity .t-product-quantity__input {
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
}

.t-product-quantity .t-product-quantity__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.t-product-quantity .t-product-quantity__button:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.06);
}

.t-product-quantity .t-product-quantity__button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.t-product-quantity .t-product-quantity__input {
    width: 100%;
    min-width: 0;
    padding: 0;
    text-align: center;
    -moz-appearance: textfield;
}

.t-product-quantity .t-product-quantity__input::-webkit-outer-spin-button,
.t-product-quantity .t-product-quantity__input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.t-product-quantity .t-product-quantity__input:focus,
.t-product-quantity .t-product-quantity__button:focus-visible {
    outline: 2px solid var(--color-primary, #0000FF);
    outline-offset: -2px;
}

/* Payment method logos */
.t-payment-method {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.t-payment-method img {
    display: block;
    width: auto;
    max-width: 100%;
    height: 28px;
    object-fit: contain;
}

@media (width <= 48rem) {
    .t-payment-method img {
        height: 14px;
    }
}

/* Floating contact button */
.t-contact-button {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: var(--z-contact-button, 40);
    display: flex;
    pointer-events: none;
}

.t-contact-button > * {
    pointer-events: auto;
}

.t-contact-button__link {
    height: 64px;
    width: 64px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    background-color: var(--color-primary);
    border-radius: 100%;
    color: white;
    padding: 0;
}

@media (width <= 48rem) {
    .t-contact-button {
        right: 16px;
        bottom: 16px;
    }
}

/* Sticky header (engine 1 set this inline from theme.js) */
.t-header[data-header-sticky-root] {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky-header);
    width: 100%;
    background-color: white;
}

/* Side menu drawer (theme-overlays.js opens and closes it) */
.t-side-menu {
    position: fixed;
    inset: 0;
    z-index: var(--z-side-menu, 9998);
    visibility: hidden;
    pointer-events: none;
    overflow: hidden;
}

.t-side-menu[data-open='true'] {
    visibility: visible;
    pointer-events: auto;
}

.t-side-menu[data-closing='true'] {
    visibility: visible;
    pointer-events: none;
}

.t-side-menu__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    opacity: 0;
    transition: opacity 0.24s ease;
}

.t-side-menu__panel {
    position: relative;
    z-index: 1;
    width: min(28rem, calc(100vw - 2rem));
    height: 100%;
    max-width: 100%;
    background: white;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.12);
    transform: translateX(calc(-100% - 1rem));
    transition: transform 0.28s ease;
    will-change: transform;
}

.t-side-menu[data-open='true'] .t-side-menu__backdrop {
    opacity: 1;
}

.t-side-menu[data-open='true'] .t-side-menu__panel {
    transform: translateX(0);
}

body.t-side-menu-open {
    overflow: hidden;
}

@media (width <= 48rem) {
    .t-side-menu__panel {
        width: min(24rem, calc(100vw - 1rem));
    }
}
