/* UI Polish / Utility Layer (loaded last)
   Focus: spacing consistency, card refinement, accessibility focus states, truncation helpers.
*/
:root {
    --yw-focus-ring: 0 0 0 3px rgba(254, 76, 80, .4);
    --yw-transition: .18s cubic-bezier(.4, 0, .2, 1);
    --btn-min-h: 2.25rem;
    /* default button min height */
    --btn-sm-min-h: 1.875rem;
    /* small button min height */
}

/* General improvements */
body {
    -webkit-font-smoothing: antialiased;
}

/* Normalize button label wrapping and alignment without forcing height */
.btn {
    white-space: nowrap;
    vertical-align: middle;
}

.btn-sm,
.btn-group-sm>.btn {
    min-height: var(--btn-sm-min-h);
}

/* Extra small button size used in admin views */
.btn-xs {
    padding: .125rem .35rem;
    font-size: .75rem;
    line-height: 1.2;
    border-radius: .2rem;
    min-height: 1.5rem;
}

/* Keep icons centered and consistent spacing inside buttons */
.btn i,
.btn .fa,
.btn .fas,
.btn .far {
    line-height: 1;
}

/* Input groups: ensure button height matches controls exactly */
.input-group>.input-group-append>.btn,
.input-group>.input-group-prepend>.btn,
.input-group .btn {
    height: 100%;
}

/* Focus ring for key interactive elements */
.navbar a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
.nav-search-toggle:focus-visible {
    outline: none !important;
    box-shadow: var(--yw-focus-ring);
}

/* Navbar: keep search toggle and hamburger vertically centered */
.nav-search-toggle,
.hamburger_container {
    display: inline-flex;
    align-items: center;
}

/* Large call-to-action buttons: predictable height on mobile */
@media (max-width: 575.98px) {

    .btn.btn-block,
    .btn.w-100 {
        min-height: 2.75rem;
    }
}

/* Hover elevation */
.card-hover-elevate {
    transition: box-shadow var(--yw-transition), transform var(--yw-transition);
}

.card-hover-elevate:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
    transform: translateY(-2px);
}

/* Card image normalization to avoid layout shifts across devices */
.card .card-img-top.img-fluid {
    width: 100%;
    height: auto;
}

/* Product listing and sliders: make image heights consistent */
.product-card .card-img-top {
    height: 180px;
    object-fit: cover;
}

.product_slider_item .card-img-top {
    height: 160px;
    object-fit: cover;
}

/* Title clamp utilities (line-height ~1.2) */
.title-clamp-2,
.title-clamp-3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.title-clamp-2 {
    -webkit-line-clamp: 2;
    line-clamp: 2;
    min-height: 2.4em;
}

.title-clamp-3 {
    -webkit-line-clamp: 3;
    line-clamp: 3;
    min-height: 3.6em;
}

/* Truncate multi-line small text */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

/* Subtle button variant */
.btn-soft-primary {
    color: var(--theme-color);
    background: rgba(254, 76, 80, .12);
    border: 1px solid rgba(254, 76, 80, .4);
}

.btn-soft-primary:hover {
    background: rgba(254, 76, 80, .18);
    color: var(--theme-color);
}

/* Spacing helpers */
.mt-1h {
    margin-top: .375rem !important;
}

.mb-1h {
    margin-bottom: .375rem !important;
}

.gap-1 {
    gap: .25rem;
}

.gap-2 {
    gap: .5rem;
}

.gap-3 {
    gap: 1rem;
}

/* Image helpers */
.img-cover {
    object-fit: cover;
}

.rounded-6 {
    border-radius: 6px;
}

/* Product card refinement */
.product-card .card-body {
    display: flex;
    flex-direction: column;
}

.product-card .card-title a {
    transition: color var(--yw-transition);
}

/* Clamp product titles to prevent button displacement */
.product-card .card-title,
.product_slider_item .card-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    min-height: 2.4em;
}

.product-card .card-title a:focus-visible {
    box-shadow: var(--yw-focus-ring);
    border-radius: 3px;
    outline: none;
}

.discount-badge {
    font-size: .75rem;
    padding: .35rem .5rem;
    letter-spacing: .5px;
}

/* Badge inside buttons: keep from stretching height */
.btn .badge {
    line-height: 1;
}

/* Wishlist / cart mini buttons standard size */
.product-card form button.btn-sm,
.product-card form a.btn-sm {
    min-width: 52px;
}

/* Utilities for inline style replacements */
/* Product/gallery thumbnails */
.thumb-wrap {
    width: 120px;
}

.thumb-img {
    width: 100%;
    height: 80px;
    object-fit: cover;
}

.minh-title-2 {
    min-height: 2.4em;
}

.minh-desc-2 {
    min-height: 2.3em;
}

.fs-095 {
    font-size: .95rem !important;
}

.fs-09 {
    font-size: .9rem !important;
}

.lh-12 {
    line-height: 1.2 !important;
}

/* Newsletter notification container resilience */
.newsletter-notif {
    transition: opacity var(--yw-transition), transform var(--yw-transition);
}

/* Table column width helpers */
.col-w-35 {
    width: 35%;
}

.col-w-15 {
    width: 15%;
}

.col-w-25 {
    width: 25%;
}

.col-w-30 {
    width: 30%;
}

/* Fixed pixel column widths */
.col-w-40px {
    width: 40px;
}

.col-w-70px {
    width: 70px;
}

.col-w-120px {
    width: 120px;
}

/* Social icon circle */
.social-icon-circle {
    background: #1e1e27;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Slider row gaps override using utility class instead of inline style */
.flex-gap-15 {
    gap: 1.5rem;
}

/* Smooth fade-in for dynamically injected product cards */
.product-card-wrapper {
    animation: productCardFade .25s ease;
}

@keyframes productCardFade {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Wishlist thumbnail */
.wishlist-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
}

/* Horizontal slider card sizing (home new arrivals etc.) */
.slider-item {
    min-width: 260px;
    max-width: 300px;
    margin-bottom: 1rem;
}

@media (max-width:576px) {
    .slider-item {
        min-width: 170px !important;
        max-width: 200px !important;
    }
}

/* Responsive adjustments */
@media (max-width:575.98px) {
    .product-card .card-title a {
        font-size: .92rem;
    }

    .discount-badge {
        top: 6px;
        left: 6px;
    }
}

/* Width utilities & tiny badge */
.w-180 {
    max-width: 180px !important;
}

.w-160 {
    max-width: 160px !important;
}

.w-200 {
    max-width: 200px !important;
}

.badge-tiny {
    font-size: .75rem;
}

.nowrap {
    white-space: nowrap !important;
}

img.logo-preview {
    max-height: 70px;
    height: auto;
    width: auto;
}

/* Admin/product form & media utilities */
.w-140 {
    max-width: 140px !important;
    width: 140px !important;
}

.img-prev-160x120 {
    max-width: 160px;
    max-height: 120px;
    object-fit: cover;
    border-radius: 6px;
}

.img-thumb-120x90 {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
}

.img-square-42 {
    width: 42px;
    height: 42px;
    object-fit: cover;
}

.img-square-48 {
    width: 48px;
    height: 48px;
    object-fit: cover;
}

/* Badge size variants */
.badge-sm {
    font-size: .85rem;
}

/* Pre / text whitespace helpers */
.pre-wrap {
    white-space: pre-wrap !important;
}

.pre-wrap-sm {
    white-space: pre-wrap !important;
    font-family: inherit;
    font-size: .9rem;
}

/* Scroll container utilities */
.scroll-y-480 {
    max-height: 480px;
    overflow: auto;
}

/* Prevent long labels/values from breaking layouts */
.text-nowrap-soft {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Keep action button clusters from wrapping awkwardly on small screens */
.actions .btn,
td.actions .btn {
    margin-right: .25rem;
}

@media (max-width: 575.98px) {

    .actions .btn,
    td.actions .btn {
        margin-bottom: .25rem;
    }
}

/* Stabilize pagination controls */
.pagination .page-link {
    min-width: 2.25rem;
    text-align: center;
}

/* Ensure collapsed elements animate smoothly even if Bootstrap JS is unavailable */
.collapse:not(.show) {
    display: none;
}

/* Keep final action row at bottom for consistent placement */
.product-card .card-body>.d-flex.justify-content-between,
.product-card .card-body>.d-flex.align-items-center,
.product-card .card-body>.row:last-child {
    margin-top: auto;
}

/* Prevent input-group buttons from shrinking too small */
.input-group .btn {
    flex: 0 0 auto;
}

/* Search/listing: tighten mobile card image height slightly */
@media (max-width: 575.98px) {
    .product-card .card-img-top {
        height: 160px;
    }
}

/* Single product page: keep qty + buttons aligned on wrap */
.single_product_container .form-inline .form-control {
    vertical-align: middle;
}

@media (max-width: 575.98px) {
    .single_product_container .form-inline {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
    }

    .single_product_container .form-inline .form-control {
        margin-bottom: .5rem;
    }
}

/* Breadcrumbs: allow safe wrapping without overflow */
.breadcrumbs ul,
.breadcrumb {
    flex-wrap: wrap;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {

    .card-hover-elevate,
    .product-card-wrapper {
        animation: none !important;
        transition: none !important;
    }
}

/* Enhance responsive tables scrolling on iOS */
.table-responsive {
    overflow-x: auto;
}

/* Public: wishlist and order history mobile tweaks */
@media (max-width: 575.98px) {

    /* Avoid overflow by ellipsizing long cell contents */
    .wishlist_table td[data-label],
    .order_history_table td[data-label] {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Slightly reduce wishlist thumbnails to save space */
    .wishlist-thumb {
        width: 48px;
        height: 48px;
    }
}

/* Admin: stacked table polish on extra small screens */
@media (max-width: 575.98px) {
    .admin-main table.table tbody td {
        overflow: hidden;
        text-overflow: ellipsis;
    }
}