/* 
 * Haztap Outfit Builder - Premium UI Styles v1.1
 * Mobile-First, Awwwards Style
 * Typography: fully inherited from WordPress theme (no hardcoded font-family)
 */

:root {
    --hob-bg:           #f4f4f6;
    --hob-surface:      #ffffff;
    --hob-border:       rgba(0, 0, 0, 0.07);
    --hob-primary:      #111111;
    --hob-primary-hover:#2d2d2d;
    --hob-active:       var(--hob-primary); /* Can be overridden */
    --hob-accent:       #111111;
    --hob-danger:       #e53935;
    --hob-danger-hover: #c62828;
    --hob-muted:        rgba(0,0,0,0.4);
    --hob-shadow-xs:    0 1px 4px rgba(0,0,0,0.04);
    --hob-shadow-sm:    0 4px 14px rgba(0,0,0,0.06);
    --hob-shadow-md:    0 10px 30px rgba(0,0,0,0.08);
    --hob-shadow-lg:    0 25px 50px rgba(0,0,0,0.14);
    --hob-radius:       18px;
    --hob-radius-sm:    12px;
    --hob-radius-xs:    8px;
    --hob-ease:         cubic-bezier(0.25, 0.8, 0.25, 1);
    --hob-transition:   all 0.28s var(--hob-ease);
}

/* ── Reset scoped to plugin ── */
.hob-container,
.hob-container * {
    box-sizing: border-box;
    font-family: inherit;   /* Inherits theme font — never hardcoded */
}

/* ══════════════════════════════
   MAIN CONTAINER
══════════════════════════════ */
.hob-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    height: auto;
    background: var(--hob-bg);
    border-radius: var(--hob-radius);
    padding: 14px;
    box-shadow: var(--hob-shadow-md);
}

/* Suppress any rogue <p> or <br> tags WordPress may inject */
.hob-container > p,
.hob-container > br {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
}

/* ══════════════════════════════
   COLUMN HEADERS
══════════════════════════════ */
.hob-categories-col h3,
.hob-products-col h3 {
    margin: 0 0 12px 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.45;
}

/* ══════════════════════════════
   CATEGORIES — Horizontal pill bar (mobile)
══════════════════════════════ */
.hob-categories-col {
    background: var(--hob-surface);
    border-radius: var(--hob-radius-sm);
    padding: 14px;
    box-shadow: var(--hob-shadow-xs);
}

#hob-categories-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
#hob-categories-list::-webkit-scrollbar { display: none; }

#hob-categories-list li {
    padding: 8px 18px;
    background: #f0f0f2;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--hob-transition);
    white-space: nowrap;
    font-size: 0.88rem;
    font-weight: 500;
    border: 1.5px solid transparent;
    user-select: none;
}

#hob-categories-list li:hover {
    background: #e5e5e8;
}

#hob-categories-list li.active {
    background: var(--hob-active);
    color: #fff;
    border-color: var(--hob-active);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

/* ══════════════════════════════
   PRODUCTS GRID
══════════════════════════════ */
.hob-products-col {
    background: var(--hob-surface);
    border-radius: var(--hob-radius-sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--hob-shadow-xs);
}

.hob-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.15) transparent;
}

.hob-product-card {
    min-width: 140px;
    max-width: 140px;
    background: var(--hob-surface);
    border: 1.5px solid var(--hob-border);
    border-radius: var(--hob-radius-sm);
    padding: 12px 10px 10px;
    cursor: pointer;
    transition: var(--hob-transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hob-product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hob-shadow-md);
    border-color: transparent;
}

.hob-product-card:active {
    transform: translateY(-2px) scale(0.98);
}

.hob-card-img-wrap {
    width: 100%;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    overflow: hidden;
    border-radius: 8px;
    background: #f8f8f8;
}

.hob-product-card img {
    max-width: 100%;
    max-height: 110px;
    object-fit: contain;
    transition: transform 0.3s var(--hob-ease);
}

.hob-product-card:hover img {
    transform: scale(1.06);
}

.hob-card-body {
    width: 100%;
    text-align: center;
}

.hob-product-title {
    font-size: 0.78rem;
    line-height: 1.3;
    opacity: 0.85;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hob-product-price {
    font-size: 0.9rem;
    font-weight: 700;
}

.hob-card-add-hint {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: var(--hob-primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
    padding: 5px 0;
    transform: translateY(100%);
    transition: transform 0.22s var(--hob-ease);
    letter-spacing: 0.03em;
}

.hob-product-card:hover .hob-card-add-hint {
    transform: translateY(0);
}

/* Empty/loading messages */
.hob-empty-msg {
    font-size: 0.85rem;
    opacity: 0.45;
    margin: auto;
    padding: 20px;
    text-align: center;
}

/* Loading dots animation */
.hob-loading {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 20px;
    margin: auto;
}
.hob-loading span {
    display: block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--hob-primary);
    opacity: 0.25;
    animation: hob-dot-pulse 1.2s ease-in-out infinite;
}
.hob-loading span:nth-child(2) { animation-delay: 0.2s; }
.hob-loading span:nth-child(3) { animation-delay: 0.4s; }

@keyframes hob-dot-pulse {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.9); }
    40%            { opacity: 1;   transform: scale(1.15); }
}

/* ══════════════════════════════
   CANVAS COLUMN
══════════════════════════════ */
.hob-canvas-col {
    background: var(--hob-surface);
    border-radius: var(--hob-radius-sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
    min-height: 480px;
    box-shadow: var(--hob-shadow-xs);
}

.hob-canvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    min-height: 36px;
}

.hob-canvas-header h3 {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.45;
}

/* ── Canvas Toolbar ── */
.hob-canvas-toolbar {
    display: flex;
    gap: 6px;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.hob-canvas-toolbar.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.hob-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 8px;
    border: 1.5px solid var(--hob-border);
    background: #f4f4f6;
    color: var(--hob-primary);
    cursor: pointer;
    transition: var(--hob-transition);
    padding: 0;
}

.hob-tool-btn:hover {
    background: var(--hob-primary);
    color: #fff;
    border-color: var(--hob-primary);
    box-shadow: var(--hob-shadow-sm);
    transform: scale(1.08);
}

.hob-tool-btn.hob-tool-delete:hover {
    background: var(--hob-danger);
    border-color: var(--hob-danger);
}

/* ── Canvas Wrapper ── */
.hob-canvas-wrapper {
    position: relative;
    flex: 1 1 auto;       /* Absorbs all free space so the button stays compact */
    min-height: 300px;
    background: #fafafa;
    border: 1.5px dashed rgba(0,0,0,0.1);
    border-radius: var(--hob-radius-sm);
    overflow: hidden;
}

/* Fabric canvas elements must fill the wrapper */
.hob-canvas-wrapper canvas {
    display: block;
}

/* ── Empty State ── */
.hob-canvas-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    pointer-events: none;
    color: var(--hob-muted);
    text-align: center;
    padding: 20px;
}

.hob-canvas-empty svg {
    opacity: 0.25;
}

.hob-canvas-empty p {
    font-size: 0.9rem;
    opacity: 0.6;
    margin: 0;
    max-width: 200px;
    line-height: 1.5;
}

/* ── Add to Cart Button ── */
.hob-btn-primary {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    white-space: nowrap !important;
    background: var(--hob-primary);
    color: #fff;
    border: none;
    padding: 0 20px !important;
    font-size: 0.95rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: var(--hob-transition);
    width: 100%;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    min-height: 52px !important;
    max-height: 52px !important;
    height: 52px !important;
    box-shadow: 0 4px 18px rgba(0,0,0,0.18);
    margin-top: 12px;
}

.hob-btn-primary:hover {
    background: var(--hob-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.22);
}

.hob-btn-primary:active {
    transform: translateY(0);
}

.hob-btn-primary:disabled {
    background: #d1d1d6;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
    color: rgba(255,255,255,0.7);
}

/* ══════════════════════════════
   VARIATIONS MODAL — Glassmorphism
══════════════════════════════ */
.hob-modal {
    position: fixed;
    z-index: 999999;
    inset: 0;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s var(--hob-ease), visibility 0.3s;
}

.hob-modal.show {
    opacity: 1;
    visibility: visible;
}

.hob-modal-content {
    background: var(--hob-surface);
    padding: 36px 32px;
    border-radius: 24px;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--hob-shadow-lg);
    border: 1px solid rgba(255,255,255,0.6);
    transform: translateY(16px) scale(0.98);
    transition: transform 0.3s var(--hob-ease);
}

.hob-modal.show .hob-modal-content {
    transform: translateY(0) scale(1);
}

.hob-modal-close {
    position: absolute;
    top: 18px; right: 22px;
    font-size: 26px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    color: #aaa;
    background: none;
    border: none;
    padding: 2px;
    transition: color 0.2s;
}
.hob-modal-close:hover { color: var(--hob-primary); }

.hob-modal-content h2 {
    margin: 0 0 22px;
    font-size: 1.35rem;
    font-weight: 800;
}

.hob-variation-group {
    background: #f7f7f9;
    padding: 16px;
    border-radius: var(--hob-radius-sm);
    margin-bottom: 14px;
    border: 1.5px solid var(--hob-border);
}

.hob-variation-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.hob-variation-item-header img {
    width: 42px; height: 42px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #eee;
    background: #fff;
    padding: 2px;
}

.hob-variation-item-header strong {
    font-size: 0.9rem;
}

.hob-variation-group select {
    width: 100%;
    padding: 11px 38px 11px 14px;
    margin-bottom: 8px;
    border-radius: var(--hob-radius-xs);
    border: 1.5px solid #ddd;
    background: #fff;
    font-size: 0.92rem;
    font-family: inherit;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' 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;
    background-size: 16px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.hob-variation-group select:last-child { margin-bottom: 0; }
.hob-variation-group select:focus {
    outline: none;
    border-color: var(--hob-primary);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

/* ══════════════════════════════
   DESKTOP (992px+) — 3 column full-height
══════════════════════════════ */
@media (min-width: 992px) {
    .hob-container {
        flex-direction: row;
        align-items: stretch;
        height: calc(100vh - 130px);
        min-height: 600px;
        overflow: hidden;
    }

    .hob-categories-col {
        width: 20%;
        flex-shrink: 0;
        overflow-y: auto;
        scrollbar-width: thin;
    }

    #hob-categories-list {
        flex-direction: column;
        overflow-x: visible;
        overflow-y: visible;
    }

    #hob-categories-list li {
        width: 100%;
    }

    .hob-products-col {
        width: 30%;
        flex-shrink: 0;
        overflow: hidden;
    }

    .hob-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
        grid-auto-rows: max-content;
        overflow-y: auto;
        overflow-x: hidden;
        flex: 1;
        padding-bottom: 0;
        height: calc(100% - 50px); /* leave room for the header */
    }

    .hob-canvas-col {
        flex: 1;
        overflow: hidden;
    }

    .hob-canvas-wrapper {
        height: auto;
        flex-grow: 1;
        min-height: 0;
    }
}

/* ══════════════════════════════
   TABLET (640–991px)
══════════════════════════════ */
@media (min-width: 640px) and (max-width: 991px) {
    .hob-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        overflow-x: hidden;
        overflow-y: auto;
        max-height: 320px;
    }
}
