/*
 * AAM Good Shopping — Shop / Archive Products Styles
 * Extras din: archive-product.php
 * Incarcat pe: is_shop(), is_product_category(), is_product_tag()
 * VERSION: 2.0 — Full Responsive + UX Improvements
 * ==========================================================================
 */

/* ==========================================================================
   1. RESETARE ASTRA SI WOOCOMMERCE DEFAULT
   ========================================================================== */
body.aam-dark-shop,
body.aam-dark-shop .site-content,
body.aam-dark-shop #primary,
body.aam-dark-shop #content {
    background-color: #0a0e1a !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
}

body.aam-dark-shop .ast-container {
    max-width: 100% !important;
    padding: 0 !important;
}

.ast-woocommerce-container>*:not(#aam-custom-shop),
.woocommerce-breadcrumb,
.woocommerce-products-header,
.woocommerce-result-count,
.woocommerce-ordering,
ul.products {
    display: none !important;
}

/* ==========================================================================
   2. VARIABILE SI DESIGN GENERAL SHOP
   ========================================================================== */
#aam-custom-shop {
    --bg-main: #0a0e1a;
    --bg-panel: #141b2d;
    --bg-panel-hover: #1a2340;
    --bg-input: #0f1524;
    --accent-blue: #3B82F6;
    --accent-light: #60A5FA;
    --accent-green: #10B981;
    --text-white: #F1F5F9;
    --text-gray: #94A3B8;
    --text-muted: #64748B;
    --border-color: rgba(59, 130, 246, 0.15);
    --border-hover: rgba(59, 130, 246, 0.4);
    --radius-card: 20px;
    --radius-btn: 10px;
    --transition: 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-family: 'Outfit', sans-serif;
    color: var(--text-white);
    width: 100%;
    position: relative;
    z-index: 10;
    box-sizing: border-box;
}

#aam-custom-shop * {
    box-sizing: border-box;
}

/* ==========================================================================
   3. WRAPPER & EFECTE FUNDAL
   ========================================================================== */
.shop-wrapper {
    /* FIX: padding-top redus pe mobil prin clamp — era 160px fix */
    padding-top: clamp(120px, 14vw, 160px);
    padding-bottom: 100px;
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

.shop-bg-effects {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 600px;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.shop-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
}

/* ==========================================================================
   4. HEADER TITLU SECTIUNE
   ========================================================================== */
.shop-header-title {
    text-align: center;
    margin-bottom: 3.5rem;
    position: relative;
    z-index: 2;
    padding: 0 20px;
}

.shop-header-title .label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent-light);
    margin-bottom: 1rem;
}

.shop-header-title .label::before,
.shop-header-title .label::after {
    content: '';
    width: 24px;
    height: 1px;
    background: var(--accent-blue);
}

.shop-header-title h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    color: var(--text-white) !important;
    margin-bottom: 1.25rem;
    line-height: 1.15;
}

.shop-header-title h1 span {
    background: linear-gradient(135deg, #60A5FA, #3B82F6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shop-header-title p {
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    color: var(--text-gray);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ==========================================================================
   5. LAYOUT GRID PRINCIPAL (Sidebar + Content)
   ========================================================================== */
.shop-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    position: relative;
    z-index: 10;
}

/* Desktop: sidebar lat de 260px */
@media (min-width: 992px) {
    .shop-container {
        grid-template-columns: 260px 1fr;
        align-items: start;
        gap: 32px;
        padding: 0 32px;
    }
}

/* ==========================================================================
   6. SIDEBAR — FILTRE & SEARCH
   ========================================================================== */
.shop-sidebar {
    position: sticky;
    top: 120px;
}

/* MOBIL: sidebar orizontal sub titlu, nu mai e sticky */
@media (max-width: 991px) {
    .shop-sidebar {
        position: static;
        top: auto;
    }
}

.glass-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 28px 22px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* SEARCH */
.search-widget {
    margin-bottom: 1.75rem;
    position: relative;
}

.search-widget input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    /* FIX: border-radius scos din inline style si pus aici */
    border-radius: 25px;
    color: var(--text-white);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.search-widget input::placeholder {
    color: var(--text-gray);
    opacity: 0.7;
}

.search-widget input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-widget svg {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-gray);
    pointer-events: none;
}

/* TITLU WIDGET */
.widget-title {
    color: var(--text-white) !important;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1.25rem;
    border-left: 3px solid var(--accent-blue);
    padding-left: 0.875rem;
    letter-spacing: 0.02em;
}

/* FILTER DROPDOWN — identic vizual cu dropdown-ul de sortare */
.shop-filter-select-wrap {
    width: 100%;
}

#custom-shop-filter {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    background-color: var(--bg-input);
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    border: 1px solid var(--border-color);
    color: var(--text-white);
    padding: 11px 40px 11px 16px;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#custom-shop-filter:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

#custom-shop-filter option {
    background: var(--bg-panel);
    color: var(--text-white);
}

/* ==========================================================================
   7. TOOLBAR (Rezultate & Sortare)
   ========================================================================== */
.shop-content-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    min-width: 0;
    /* FIX: previne overflow în grid */
}

.shop-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 12px 20px;
    border-radius: 14px;
    gap: 12px;
}

.shop-results-count {
    color: var(--text-gray);
    font-size: 0.9rem;
}

.shop-results-count span {
    color: var(--text-white);
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.shop-sort select {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--bg-input);
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    border: 1px solid var(--border-color);
    color: var(--text-white);
    padding: 9px 36px 9px 14px;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s;
    min-width: 180px;
}

.shop-sort select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.shop-sort select option {
    background: var(--bg-panel);
    color: var(--text-white);
}

/* ==========================================================================
   8. GRID PRODUSE
   ========================================================================== */
.products-grid {
    display: grid;
    /* MOBIL: 1 coloana; TABLET: 2; DESKTOP: auto-fill */
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: stretch;
    width: 100%;
}

@media (min-width: 560px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }
}

/* ==========================================================================
   9. CARD SERVICIU
   ========================================================================== */
.shop-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    overflow: hidden;
    transition: transform var(--transition), border-color var(--transition),
        box-shadow var(--transition), background var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* Linie de accent top la hover */
.shop-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-light));
    opacity: 0;
    transition: opacity var(--transition);
}

.shop-card:hover::before {
    opacity: 1;
}

.shop-card:hover {
    transform: translateY(-6px);
    border-color: var(--border-hover);
    box-shadow: 0 16px 48px rgba(59, 130, 246, 0.12),
        0 4px 16px rgba(0, 0, 0, 0.4);
    background: var(--bg-panel-hover);
}

/* HEADER CARD — zona iconiță */
.shop-card__header {
    padding: 2rem 1.75rem;
    background: linear-gradient(160deg, rgba(59, 130, 246, 0.07) 0%, transparent 60%);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    gap: 12px;
}

/* INDEX numar card (opțional dacă îl adaugi) */
.shop-card__index {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    opacity: 0.6;
}

/* ICONIȚA */
.shop-card__icon {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: rgba(59, 130, 246, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
    transition: all 0.4s ease;
    border: 1px solid rgba(59, 130, 246, 0.15);
    flex-shrink: 0;
}

/* FIX CRITIC: SVG-urile au stroke, NU fill — fill: none previne suprascriere */
.shop-card__icon svg {
    width: 28px;
    height: 28px;
    /* FIX: scos fill: currentColor — SVG-urile folosesc stroke="currentColor" */
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.shop-card:hover .shop-card__icon {
    transform: scale(1.08) rotate(4deg);
    background: rgba(59, 130, 246, 0.18);
    color: var(--accent-light);
    box-shadow: 0 0 24px rgba(59, 130, 246, 0.25);
}

/* BODY CARD */
.shop-card__body {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* TAG CATEGORIE */
.shop-card__tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-light);
    font-weight: 600;
    margin-bottom: 0.65rem;
    display: block;
    opacity: 0.85;
}

/* TITLU */
.shop-card__title {
    font-size: 1.1rem;
    margin-bottom: 0.65rem;
    line-height: 1.35;
    font-weight: 700;
}

.shop-card__title a {
    color: var(--text-white);
    text-decoration: none;
    transition: color 0.25s;
}

.shop-card__title a:hover {
    color: var(--accent-light);
}

/* EXCERPT */
.shop-card__excerpt {
    color: var(--text-gray);
    font-size: 0.88rem;
    line-height: 1.65;
    margin-bottom: 1.25rem;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* FOOTER CARD */
.shop-card__footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

/* PRET */
.shop-card__price {
    color: var(--text-white);
    font-size: 1.15rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1;
}

/* Stiluri preț WooCommerce */
.shop-card__price .woocommerce-Price-currencySymbol {
    font-size: 0.85em;
    opacity: 0.7;
}

.price-request {
    font-size: 0.88rem;
    color: var(--text-gray);
    font-style: italic;
}

/* ==========================================================================
   10. BUTOANE ACTIUNE CARD
   ========================================================================== */
.btn-action {
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-btn);
    transition: background 0.3s, color 0.3s, box-shadow 0.3s, transform 0.25s;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    flex-shrink: 0;
}

.btn-action.icon-only {
    width: 42px;
    height: 42px;
}

.btn-action.icon-only svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-action.text-btn {
    padding: 9px 16px;
    font-size: 0.82rem;
    border-color: rgba(59, 130, 246, 0.4);
    color: var(--text-white);
    letter-spacing: 0.01em;
}

.btn-action:hover {
    background: var(--accent-blue);
    color: #fff;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
    transform: translateY(-2px);
    border-color: var(--accent-blue);
}

/* ==========================================================================
   11. EMPTY STATE (Nu s-au găsit rezultate la filtrare)
   ========================================================================== */
.shop-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    background: var(--bg-panel);
    border-radius: var(--radius-card);
    border: 1px dashed rgba(59, 130, 246, 0.2);
    color: var(--text-gray);
    gap: 16px;
}

.shop-empty-state svg {
    width: 48px;
    height: 48px;
    stroke: var(--text-muted);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.5;
}

.shop-empty-state p {
    font-size: 1rem;
    margin: 0;
    color: var(--text-gray);
}

.shop-empty-state small {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   12. ALERTE / NOTICE WOOCOMMERCE
   ========================================================================== */
.woocommerce-notices-wrapper {
    grid-column: 1 / -1;
    margin-bottom: 0.5rem;
    width: 100%;
    order: -1;
}

.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
    background-color: var(--bg-panel) !important;
    color: var(--text-white) !important;
    border-top: 3px solid var(--accent-blue) !important;
    padding: 1.2rem 1.5rem 1.2rem 3.5rem !important;
    border-radius: 8px;
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 1.5rem !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    font-family: 'Outfit', sans-serif;
    position: relative;
}

.woocommerce-error {
    border-top-color: #EF4444 !important;
}

.woocommerce-message {
    border-top-color: var(--accent-green) !important;
}

.woocommerce-message::before,
.woocommerce-info::before,
.woocommerce-error::before {
    position: absolute !important;
    left: 1.2rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.woocommerce-error::before {
    color: #EF4444 !important;
}

.woocommerce-message::before {
    color: var(--accent-green) !important;
}

.woocommerce-message .button,
.woocommerce-info .button,
.woocommerce-error .button {
    background: var(--accent-blue) !important;
    color: white !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    border: none !important;
    margin-left: auto !important;
    order: 2 !important;
    white-space: nowrap;
    transition: background 0.3s ease !important;
}

.woocommerce-message .button:hover,
.woocommerce-info .button:hover,
.woocommerce-error .button:hover {
    background: #2563EB !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3) !important;
}

/* ==========================================================================
   13. ANIMATII FILTRARE JS
   ========================================================================== */
.shop-card.fade-in {
    animation: fadeInProduct 0.35s ease forwards;
}

.shop-card[style*="display: none"] {
    animation: none;
}

@keyframes fadeInProduct {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   14. RESPONSIVE MOBILE (< 560px)
   ========================================================================== */
@media (max-width: 559px) {
    .shop-wrapper {
        padding-bottom: 60px;
    }

    .shop-container {
        padding: 0 14px;
        gap: 1.5rem;
    }

    .shop-toolbar {
        padding: 10px 14px;
        border-radius: 12px;
    }

    .shop-sort select {
        width: 100%;
        min-width: unset;
        font-size: 0.85rem;
    }

    .shop-results-count {
        width: 100%;
        text-align: center;
    }

    .shop-card__header {
        padding: 1.5rem 1.25rem;
    }

    .shop-card__icon {
        width: 54px;
        height: 54px;
    }

    .shop-card__icon svg {
        width: 24px;
        height: 24px;
    }

    .shop-card__body {
        padding: 1.25rem;
    }

    .shop-card__title {
        font-size: 1rem;
    }

    .shop-card__price {
        font-size: 1rem;
    }
}