/* Product Smart Labels - Frontend Styles */

/* ============================================================================
   BASE STYLES
   ============================================================================ */

.wp-block-mytheme-product-smart-labels {
    --smart-labels-gap: 10px;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* Layout Variations */
.wp-block-mytheme-product-smart-labels.smart-labels-layout-horizontal {
    flex-direction: row;
    gap: var(--smart-labels-gap);
}

.wp-block-mytheme-product-smart-labels.smart-labels-layout-vertical {
    flex-direction: column;
    gap: var(--smart-labels-gap);
}

.wp-block-mytheme-product-smart-labels.smart-labels-layout-stacked {
    flex-direction: column;
    align-items: stretch;
    gap: var(--smart-labels-gap);
}

/* ============================================================================
   LABEL BASE STYLES
   ============================================================================ */

.smart-label {
    --label-bg: #9E9E9E;
    --label-text: #FFFFFF;
    --label-border: #757575;
    --label-border-width: 1px;

    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    line-height: 1;
    transition: all 0.3s ease;
    background-color: var(--label-bg);
    color: var(--label-text);
    border: var(--label-border-width) solid var(--label-border);
    white-space: nowrap;
}

/* Icon Container */
.smart-label-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.smart-label-icon svg {
    width: 1em;
    height: 1em;
}

/* Icon Position */
.smart-label-icon-left {
    flex-direction: row;
}

.smart-label-icon-right {
    flex-direction: row-reverse;
}

/* ============================================================================
   SIZE VARIATIONS
   ============================================================================ */

.smart-labels-size-small .smart-label {
    font-size: 11px;
    padding: 4px 8px;
}

.smart-labels-size-small .smart-label-icon svg {
    width: 12px;
    height: 12px;
}

.smart-labels-size-medium .smart-label {
    font-size: 13px;
    padding: 6px 12px;
}

.smart-labels-size-medium .smart-label-icon svg {
    width: 14px;
    height: 14px;
}

.smart-labels-size-large .smart-label {
    font-size: 15px;
    padding: 8px 16px;
}

.smart-labels-size-large .smart-label-icon svg {
    width: 16px;
    height: 16px;
}

/* ============================================================================
   STYLE VARIATIONS
   ============================================================================ */

/* Badge Style (default) */
.smart-labels-style-badge .smart-label,
.smart-label-badge {
    border-radius: 6px;
}

/* Pill Style */
.smart-labels-style-pill .smart-label,
.smart-label-pill {
    border-radius: 999px;
}

/* Ribbon Style */
.smart-labels-style-ribbon .smart-label,
.smart-label-ribbon {
    position: relative;
    border-radius: 4px 0 0 4px;
    padding-right: 18px;
}

.smart-labels-style-ribbon .smart-label::after,
.smart-label-ribbon::after {
    content: '';
    position: absolute;
    right: -10px;
    top: 0;
    width: 0;
    height: 0;
    border-style: solid;
}

/* Calculate ribbon arrow based on size */
.smart-labels-size-small .smart-labels-style-ribbon .smart-label::after {
    border-width: 11px 10px 11px 0;
    border-color: transparent transparent transparent var(--label-bg);
}

.smart-labels-size-medium .smart-labels-style-ribbon .smart-label::after {
    border-width: 13px 10px 13px 0;
    border-color: transparent transparent transparent var(--label-bg);
}

.smart-labels-size-large .smart-labels-style-ribbon .smart-label::after {
    border-width: 16px 12px 16px 0;
    border-color: transparent transparent transparent var(--label-bg);
}

/* Outline Style */
.smart-labels-style-outline .smart-label,
.smart-label-outline {
    background-color: transparent !important;
    border-width: 2px;
    color: var(--label-border);
}

.smart-labels-style-outline .smart-label-icon {
    color: var(--label-border);
}

/* Minimal Style */
.smart-labels-style-minimal .smart-label,
.smart-label-minimal {
    background: none !important;
    border: none !important;
    padding: 4px 8px;
    font-weight: 700;
    color: var(--label-bg);
}

.smart-labels-style-minimal .smart-label-icon {
    color: var(--label-bg);
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

/* Fade In */
@keyframes smartLabelsFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.smart-labels-animation-fade .smart-label {
    animation: smartLabelsFadeIn 0.5s ease-in;
}

/* Slide In */
@keyframes smartLabelsSlideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.smart-labels-animation-slide .smart-label {
    animation: smartLabelsSlideIn 0.5s ease-out;
}

/* Add stagger delay to multiple labels */
.smart-labels-animation-slide .smart-label:nth-child(2) {
    animation-delay: 0.1s;
}

.smart-labels-animation-slide .smart-label:nth-child(3) {
    animation-delay: 0.2s;
}

.smart-labels-animation-slide .smart-label:nth-child(4) {
    animation-delay: 0.3s;
}

.smart-labels-animation-slide .smart-label:nth-child(5) {
    animation-delay: 0.4s;
}

/* Bounce */
@keyframes smartLabelsBounce {

    0%,
    100% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.08);
    }

    50% {
        transform: scale(0.95);
    }

    80% {
        transform: scale(1.03);
    }
}

.smart-labels-animation-bounce .smart-label {
    animation: smartLabelsBounce 0.6s ease;
}

/* Scale */
@keyframes smartLabelsScale {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.smart-labels-animation-scale .smart-label {
    animation: smartLabelsScale 0.4s ease-out;
}

/* ============================================================================
   HOVER EFFECTS
   ============================================================================ */

.smart-label:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ============================================================================
   DEBUG MODE
   ============================================================================ */

.smart-label-debug {
    position: relative;
}

.smart-label-debug::before {
    content: attr(data-debug-info);
    position: absolute;
    bottom: 100%;
    left: 0;
    background: #000;
    color: #fff;
    font-size: 10px;
    font-weight: 400;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    z-index: 100;
    margin-bottom: 4px;
}

.smart-label-debug:hover::before {
    opacity: 0.9;
    visibility: visible;
}

/* ============================================================================
   RESPONSIVE STYLES
   ============================================================================ */

/* Hide on Mobile (< 768px) */
@media (max-width: 767px) {
    .smart-labels-hide-mobile {
        display: none !important;
    }

    /* Stack horizontal layout on mobile */
    .wp-block-mytheme-product-smart-labels.smart-labels-layout-horizontal {
        flex-direction: column;
    }

    /* Reduce size on mobile */
    .smart-labels-size-large .smart-label {
        font-size: 13px;
        padding: 6px 12px;
    }
}

/* Hide on Tablet (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .smart-labels-hide-tablet {
        display: none !important;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

.smart-label:focus {
    outline: 2px solid var(--label-border);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .smart-label {
        border-width: 2px !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .smart-label {
        animation: none !important;
        transition: none !important;
    }
}