/**
 * Usine Components - Shared CSS
 *
 * Global component styles used across all ACF blocks.
 * These provide base styling for components generated by
 * usine-blocks-helpers.php (usine_render_button, etc.).
 *
 * Individual block style.css files can override these with
 * their scoped selectors (e.g. .usine-bloc-header-01 .btn).
 *
 * @package Usine
 * @since 1.0.0
 */

/* ==========================================================================
   CSS Custom Properties (Design System Defaults)
   ========================================================================== */

:root {
    /* Breakpoints (for reference — CSS custom properties can't be used in @media queries,
       but these document the standard breakpoints used across all blocks) */
    --bp-mobile: 640px;
    --bp-tablet: 1024px;
    --bp-desktop: 1280px;

    --btn-primary-bg: #3C0314;
    --btn-primary-bg-hover: #2a020e;
    --btn-primary-color: #ffffff;
    --btn-secondary-color: currentColor;
    --btn-border-radius: 8px;
    --btn-font-size: 1rem;
    --btn-font-weight: 500;
    --btn-padding-y: 12px;
    --btn-padding-x: 24px;
    --btn-gap: 8px;
    --btn-transition: all 0.25s ease;

    --badge-bg: #fdf2f4;
    --badge-color: #3C0314;
    --badge-border-radius: 9999px;
    --badge-font-size: 0.75rem;
    --badge-font-weight: 600;
    --badge-padding-y: 4px;
    --badge-padding-x: 12px;

    --card-bg: #ffffff;
    --card-border: 1px solid #e5e7eb;
    --card-border-radius: 12px;
    --card-padding: 24px;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.1);
    --card-transition: all 0.3s ease;

    --section-padding-y: 80px;
    --section-padding-x: 64px;
    --section-max-width: 1312px;
    --container-xl: var(--section-max-width);
    --spacing-container-x: var(--section-padding-x);
    --focus-ring-color: #3C0314;
}

@media (max-width: 1200px) {
    :root {
        --section-padding-x: 48px;
    }
}

@media (max-width: 768px) {
    :root {
        --section-padding-x: 20px;
    }
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -48px;
    z-index: 2000;
    padding: 10px 14px;
    background: #ffffff;
    color: #232425;
    border: 2px solid var(--focus-ring-color);
    border-radius: 8px;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
    top: 16px;
}

/* ==========================================================================
   1. BUTTON SYSTEM (.btn)
   Generated by usine_render_button() in usine-blocks-helpers.php
   Classes: .btn, .btn-primary, .btn-secondary, .btn-text,
            .btn-icon-left, .btn-icon-right
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--btn-gap);
    padding: var(--btn-padding-y) var(--btn-padding-x);
    border-radius: var(--btn-border-radius);
    font-size: var(--btn-font-size);
    font-weight: var(--btn-font-weight);
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    border: none;
    position: relative;
    overflow: hidden;
    transition: var(--btn-transition);
    box-sizing: border-box;
    font-family: inherit;
}

/* Primary Button: solid colored background */
/* FIX-BTN-SPECIFICITY-001: Use single class to let usine-global-generated override */
.btn-primary {
    background-color: var(--btn-primary-bg);
    color: var(--btn-primary-color);
    border: 1px solid var(--btn-primary-bg);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--btn-primary-bg-hover);
    border-color: var(--btn-primary-bg-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Secondary Button: outlined style */
.btn-secondary {
    background-color: transparent;
    color: var(--btn-secondary-color);
    border: 1px solid currentColor;
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: rgba(0, 0, 0, 0.04);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Text Button: no background, no border */
.btn.btn-text {
    background-color: transparent;
    color: var(--btn-secondary-color);
    border: none;
    padding-left: 0;
    padding-right: 0;
}

.btn.btn-text:hover,
.btn.btn-text:focus {
    opacity: 0.8;
    transform: translateY(-1px);
}

.btn.btn-text:active {
    opacity: 1;
    transform: translateY(0);
}

/* Button Focus (accessibility) */
.btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--focus-ring-color);
    outline-offset: 2px;
}

.btn-disabled {
    cursor: default;
    pointer-events: none;
    opacity: 0.72;
}

/* Button Icons */
.btn .btn-icon-left,
.btn .btn-icon-right {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Button Text Span */
.btn .btn-text {
    display: inline;
}

/* ==========================================================================
   2. BADGE / TAG (.usine-badge)
   For pricing meta_tag, status indicators, and other pill-shaped labels.
   ========================================================================== */

.usine-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: var(--badge-padding-y) var(--badge-padding-x);
    background-color: var(--badge-bg);
    color: var(--badge-color);
    font-size: var(--badge-font-size);
    font-weight: var(--badge-font-weight);
    line-height: 1.4;
    border-radius: var(--badge-border-radius);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Variant: solid/filled */
.usine-badge--solid {
    background-color: var(--badge-color);
    color: #ffffff;
}

/* Variant: outlined */
.usine-badge--outline {
    background-color: transparent;
    border: 1px solid currentColor;
}

/* Variant: success */
.usine-badge--success {
    --badge-bg: #ecfdf5;
    --badge-color: #059669;
}

/* Variant: warning */
.usine-badge--warning {
    --badge-bg: #fffbeb;
    --badge-color: #d97706;
}

/* Variant: error */
.usine-badge--error {
    --badge-bg: #fef2f2;
    --badge-color: #dc2626;
}

/* ==========================================================================
   3. CARD (.usine-card)
   Shared card container used across features, pricing, testimonials, etc.
   ========================================================================== */

.usine-card {
    background-color: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--card-border-radius);
    padding: var(--card-padding);
    box-shadow: var(--card-shadow);
    transition: var(--card-transition);
    box-sizing: border-box;
    overflow: hidden;
}

.usine-card:hover {
    box-shadow: var(--card-shadow-hover);
}

/* Card with linked content (clickable) */
a.usine-card,
.usine-card--clickable {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

a.usine-card:hover,
.usine-card--clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

/* Card image area */
.usine-card__image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: calc(var(--card-border-radius) - 4px);
    margin-bottom: 16px;
}

.usine-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Card body content */
.usine-card__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Card header (title + badge area) */
.usine-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

/* Card footer (buttons, links) */
.usine-card__footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding-top: 16px;
}

/* Card variant: highlighted (for pricing "popular" plans, etc.) */
.usine-card--highlighted {
    border-color: var(--btn-primary-bg);
    box-shadow: 0 0 0 1px var(--btn-primary-bg), var(--card-shadow);
}

/* Card variant: flat (no border, no shadow) */
.usine-card--flat {
    border: none;
    box-shadow: none;
}

.usine-card--flat:hover {
    box-shadow: var(--card-shadow);
}

/* ==========================================================================
   4. SECTION (.usine-section)
   Common section wrapper with consistent padding and max-width.
   ========================================================================== */

.usine-section {
    width: 100%;
    padding: var(--section-padding-y) var(--section-padding-x);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.usine-section__inner {
    width: 100%;
    max-width: var(--section-max-width);
    display: flex;
    flex-direction: column;
}

/* Section header: tagline + title + description group */
.usine-section__header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 48px;
}

.usine-section__header--center {
    text-align: center;
    align-items: center;
}

/* ==========================================================================
   5. ICON-TEXT (.icon-text)
   Generated by usine_render_icon_text() in usine-blocks-helpers.php
   Classes: .icon-text, .icon-text__icon, .icon-text__text
   ========================================================================== */

.icon-text {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.icon-text__icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-text__icon img,
.icon-text__icon svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.icon-text__text {
    font-size: 16px;
    line-height: 1.5;
}

/* ==========================================================================
   6. CAROUSEL/SLIDER (.us-slider)
   Shared carousel component. JS: assets/js/slider.js (usine-theme-slider).
   Blocks add data-usine-slider="true" + .us-slider__track to activate.
   Nav buttons and dots are auto-generated by JS if not in markup.
   ========================================================================== */

/* FIX-SLIDER-ARROWS-01: overflow: hidden must be on the track, not the slider wrapper.
   Otherwise the absolutely positioned prev/next arrows (children of .us-slider) get clipped. */
.us-slider {
    position: relative;
    width: 100%;
    --us-slider-visible: 1;
    --us-slider-arrow-bg: rgba(255, 255, 255, 0.9);
    --us-slider-arrow-bg-hover: #ffffff;
    --us-slider-arrow-border-color: transparent;
    --us-slider-arrow-border-width: 0px;
    --us-slider-arrow-radius: 50%;
    --us-slider-arrow-icon-color: #000000;
    --us-slider-dot-color: #d1d5db;
    --us-slider-dot-hover-color: #9ca3af;
    --us-slider-dot-active-color: #374151;
}

.us-slider__track {
    display: flex;
    transition: transform 0.5s ease;
    overflow: hidden;
}

.us-slider__track > * {
    flex: 0 0 calc(100% / var(--us-slider-visible, 1));
    min-width: 0;
    box-sizing: border-box;
}

/* Multi-visible: attribute presets remain as fallback; JS can override via --us-slider-visible */
.us-slider[data-nbr-visible="2"] { --us-slider-visible: 2; }
.us-slider[data-nbr-visible="3"] { --us-slider-visible: 3; }
.us-slider[data-nbr-visible="4"] { --us-slider-visible: 4; }
/* FIX-SLIDER-NAVVIS-01: Extended support for 5-6 visible (JS caps at 6) */
.us-slider[data-nbr-visible="5"] { --us-slider-visible: 5; }
.us-slider[data-nbr-visible="6"] { --us-slider-visible: 6; }

/* Nav buttons */
.us-slider__prev,
.us-slider__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 48px;
    height: 48px;
    background: var(--us-slider-arrow-bg);
    border: var(--us-slider-arrow-border-width) solid var(--us-slider-arrow-border-color);
    border-radius: var(--us-slider-arrow-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.2s, box-shadow 0.2s;
}

.us-slider__prev { left: 16px; }
.us-slider__next { right: 16px; }

.us-slider__prev:hover,
.us-slider__next:hover {
    background: var(--us-slider-arrow-bg-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.us-slider__prev svg,
.us-slider__next svg {
    width: 24px;
    height: 24px;
    color: var(--us-slider-arrow-icon-color);
}

/* Dot indicators */
.us-slider__dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.us-slider__dot {
    width: 10px;
    height: 10px;
    background: var(--us-slider-dot-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, transform 0.2s;
}

.us-slider__dot:hover {
    background: var(--us-slider-dot-hover-color);
}

.us-slider__dot.is-active {
    background: var(--us-slider-dot-active-color);
    transform: scale(1.2);
}

/* ==========================================================================
   7. RESPONSIVE UTILITIES
   ========================================================================== */

/* Tablet breakpoint */
@media (max-width: 1024px) {
    :root {
        --section-padding-y: 64px;
        --section-padding-x: 32px;
    }
}

/* Mobile breakpoint */
@media (max-width: 768px) {
    :root {
        --section-padding-y: 48px;
        --section-padding-x: 20px;
        --card-padding: 16px;
    }

    /* FIX-BTN-MOBILE-001: Removed overly broad .btn { width: 100% } rule.
       Buttons should only be full-width when explicitly requested by block CSS. */

    /* Cards: reduce border-radius on mobile */
    .usine-card {
        border-radius: 8px;
    }

    /* Section header: tighter spacing on mobile */
    .usine-section__header {
        gap: 12px;
        margin-bottom: 32px;
    }

    /* Slider: force single visible on mobile */
    .us-slider[data-nbr-visible] .us-slider__track > * {
        flex: 0 0 100%;
    }

    .us-slider__prev,
    .us-slider__next {
        width: 40px;
        height: 40px;
    }

    .us-slider__prev svg,
    .us-slider__next svg {
        width: 20px;
        height: 20px;
    }
}

/* ==========================================================================
   6. ACCESSIBILITY
   ========================================================================== */

/* Small mobile breakpoint */
@media (max-width: 480px) {
    :root {
        --section-padding-y: 32px;
        --section-padding-x: 16px;
        --card-padding: 12px;
        --btn-padding-x: 16px;
        --btn-padding-y: 10px;
        --btn-font-size: 0.9rem;
    }

    .usine-card {
        border-radius: 8px;
    }
}

/* Tablet slider: 2 visible instead of 3+ */
@media (max-width: 1024px) {
    .us-slider[data-nbr-visible="3"] { --us-slider-visible: 2; }
    .us-slider[data-nbr-visible="4"] { --us-slider-visible: 2; }
    .us-slider[data-nbr-visible="5"] { --us-slider-visible: 2; }
    .us-slider[data-nbr-visible="6"] { --us-slider-visible: 3; }
}

/* Reduced motion: disable all transitions and transforms */
@media (prefers-reduced-motion: reduce) {
    .btn,
    .usine-card,
    a.usine-card,
    .usine-card--clickable,
    .us-slider__track {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }

    .btn:hover,
    .btn:focus,
    .usine-card:hover,
    a.usine-card:hover {
        transform: none !important;
    }
}

/* ==========================================================================
   7. PRINT STYLES
   ========================================================================== */

@media print {
    .btn {
        box-shadow: none !important;
        border: 1px solid currentColor;
    }

    .usine-card {
        box-shadow: none !important;
        border: 1px solid #ccc;
        break-inside: avoid;
    }

    .usine-section {
        padding: 24px 0;
    }
}
