/* ===========================================================
   MACHINERIES MARKET — index.css

   GAP FIX EXPLANATION:
   ─────────────────────────────────────────────────────────
   header.css defines .nav-bar { position:fixed; height:80px }
   The dynamic header.html is injected into #header-holder
   which sits in normal document flow — the #header-holder div
   itself has zero height because its child (.nav-bar) is fixed.

   Therefore: body { padding-top:80px } creates a PHANTOM GAP
   because there is nothing in the flow to push content below.

   THE FIX:
     • body → NO padding-top (removed completely)
     • Hero uses .video-hero + .hero-frame (in-flow video; overlay inside frame)
   =========================================================== */


/* -----------------------------------------------------------
   1. ROOT VARIABLES
----------------------------------------------------------- */
:root {
    --mm-dark-bg:    #121212;
    --mm-panel:      #1e1e1e;
    --mm-border:     #333;
    --mm-blue:       #007BFF;
    --mm-accent:     #3b82f6;
    --mm-text-main:  #e0e0e0;
    --mm-text-muted: #b0b0b0;
    --mm-green:      #28a745;
    --scan-color:    #00f3ff;

    --font-primary:   'Orbitron', sans-serif;
    --font-secondary: 'Roboto', 'Segoe UI', sans-serif;
    --font-mono:      'Roboto Mono', monospace;
}


/* -----------------------------------------------------------
   2. BASE RESET
   ⚠️  NO padding-top on body — see gap fix above
----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { overflow-y: auto; }

html, body {
    margin: 0;
    padding: 0;          /* ✅ NO padding-top here — gap fix */
    min-height: 100vh;
    background-color: var(--mm-dark-bg);
    color: var(--mm-text-main);
    font-family: var(--font-secondary);
    display: flex;
    flex-direction: column;
}

header, footer { flex: 0 0 auto; z-index: 10; position: relative; }
main, .home-main { flex: 1 1 auto; position: relative; z-index: 0; }

.home-main {
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* =========================
   HERO: full-width video
   ========================= */
.video-hero {
    position: relative;
    width: 100%;
    background: #000;
    overflow: visible;
    flex-shrink: 0;
}

.hero-frame {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    line-height: 0;
}

#hero-video {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    min-width: 0;
}

.video-overlay.weak {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
            180deg,
            rgba(0, 0, 0, 0.22) 0%,
            rgba(0, 0, 0, 0.1) 45%,
            rgba(0, 0, 0, 0.32) 100%
    );
    pointer-events: none;
}

.adcopy-wrap {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    padding-left: 5%;
    padding-right: 5%;
    pointer-events: none;
}

.adcopy-inner {
    width: 100%;
    max-width: 90%;
    text-align: center;
    color: #fff;
    line-height: 1.2;
    pointer-events: auto;
}

.adcopy-wrap.adcopy-wrap--clyde {
    place-items: center start;
    justify-items: start;
    padding: 120px 6% 72px;
}

.adcopy-inner--clyde {
    text-align: left;
    max-width: 900px;
}

/* -----------------------------------------------------------
   4. HERO OVERLAY TEXT — typography
----------------------------------------------------------- */
.hero-eyebrow {
    font-family: var(--font-primary);
    font-size: 0.72rem;
    letter-spacing: 4px;
    color: var(--mm-accent);
    text-transform: uppercase;
    margin: 0 0 14px 0;
}

.hero-title {
    font-family: var(--font-primary);
    font-size: clamp(3rem, 6vw, 5.4rem);
    font-weight: 900;
    line-height: 1.05;
    text-transform: uppercase;
    color: #fff;
    margin: 0 0 18px 0;
    text-shadow: 0 6px 28px rgba(0, 0, 0, 0.55);
}

.hero-title span { color: var(--mm-accent); }

.hero-sub {
    max-width: 720px;
    font-size: clamp(1rem, 1.35vw, 1.2rem);
    color: #dbe4ee;
    line-height: 1.75;
    margin: 0 0 28px 0;
}

.hero-actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-primary,
.btn-ghost {
    display: inline-block;
    font-family: var(--font-primary);
    font-size: 0.82rem;
    letter-spacing: 2px;
    text-decoration: none;
    text-transform: uppercase;
    padding: 14px 30px;
    border: 2px solid var(--mm-accent);
    cursor: pointer;
    transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary { background: var(--mm-accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; transform: translateY(-2px); }

.btn-ghost {
    background: rgba(15, 23, 42, 0.35);
    color: #fff;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.btn-ghost:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.35);
}

/* -----------------------------------------------------------
   5. PROMO BANNER
----------------------------------------------------------- */
.promo-banner {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    text-align: center;
    width: 90%;
    max-width: 900px;
    display: none !important;
}
.promo-banner h1 {
    font-family: var(--font-primary);
    font-size: clamp(2.8rem, 5vw, 4.5rem);
    font-weight: 800;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
    margin-bottom: 0.5em;
    color: #fff;
    display: none !important;
}
.promo-banner p {
    font-size: clamp(1.2rem, 1.8vw, 1.6rem);
    color: var(--mm-text-muted);
    display: none !important;
}

@media (max-width: 600px) {
    .machine-title { font-size: 1.5rem; }
    .machine-desc  { font-size: 0.95rem; }

    .adcopy-wrap.adcopy-wrap--clyde {
        padding: 110px 5% 48px;
        place-items: end start;
    }

    .hero-title {
        font-size: clamp(2.1rem, 9vw, 3rem);
        line-height: 1.08;
    }

    .hero-sub {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    .hero-actions { gap: 10px; }

    .btn-primary,
    .btn-ghost {
        width: 100%;
        max-width: 260px;
        text-align: center;
    }

    #ai-panel   { width: calc(100vw - 16px); right: 8px; bottom: 88px; }
    #ai-fab     { right: 16px; bottom: 18px; }
    #ai-fab-tip { right: 82px; }
}

/* -----------------------------------------------------------
   6. CATEGORY NAV BAR
----------------------------------------------------------- */
.cat-nav {
    background: #111827;
    border-bottom: 2px solid #1e2d40;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    position: sticky;
    top: 80px;
    z-index: 99;
}
.cat-nav a {
    font-family: var(--font-primary);
    font-size: 0.63rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #9ca3af;
    text-decoration: none;
    padding: 15px 20px;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}
.cat-nav a:hover,
.cat-nav a.active {
    color: var(--mm-accent);
    border-bottom-color: var(--mm-accent);
}

/* -----------------------------------------------------------
   7. FEATURES STRIP
----------------------------------------------------------- */
.features-strip {
    background: #111827;
    border-bottom: 1px solid #1e2d40;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}
.feature-item {
    padding: 34px 20px;
    border-right: 1px solid #1e2d40;
    text-align: center;
}
.feature-item:last-child { border-right: none; }
.feature-icon { font-size: 1.7rem; margin-bottom: 10px; }
.feature-item h4 {
    font-family: var(--font-primary);
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0 0 7px 0;
    color: #f9fafb;
}
.feature-item p {
    font-size: 0.77rem;
    color: #9ca3af;
    line-height: 1.6;
    margin: 0;
}

@media (max-width: 900px) {
    .features-strip { grid-template-columns: repeat(2, 1fr); }
    .feature-item:nth-child(2) { border-right: none; }
    .feature-item:nth-child(1),
    .feature-item:nth-child(2) { border-bottom: 1px solid #1e2d40; }
}
@media (max-width: 480px) {
    .features-strip { grid-template-columns: 1fr; }
    .feature-item   { border-right: none; border-bottom: 1px solid #1e2d40; }
}

/* -----------------------------------------------------------
   8. SECTION HEADER
----------------------------------------------------------- */
.section-header { text-align: center; padding: 60px 20px 30px; }
.section-header h2 {
    font-family: var(--font-primary);
    font-size: clamp(1.2rem, 3vw, 1.9rem);
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #f9fafb;
    margin: 0;
}
.section-header p { color: #9ca3af; margin: 10px 0 0; font-size: 0.92rem; }
.section-divider {
    width: 54px; height: 3px;
    background: var(--mm-accent);
    margin: 12px auto 0;
}

/* -----------------------------------------------------------
   9. PRODUCT SECTION
----------------------------------------------------------- */
.dark-product-section {
    padding: 80px 0;
    background-color: var(--mm-dark-bg);
}
.product-row-container {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--section-pad-x);
}
.machine-row {
    display: flex;
    align-items: stretch;
    justify-content: center;
    margin-bottom: 100px;
    background-color: var(--mm-panel);
    border: 1px solid var(--mm-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease;
    min-height: 600px;
}
.machine-row:hover {
    transform: translateY(-5px);
    border-color: var(--mm-blue);
}
.machine-row:nth-child(even) { flex-direction: row-reverse; }

/* -----------------------------------------------------------
   10. BLUEPRINT LASER SCAN
----------------------------------------------------------- */
.machine-visual {
    flex: 1.2;
    position: relative;
    background: #000;
    overflow: hidden;
    display: block;
    cursor: pointer;
}
.visual-inner { width: 100%; height: 100%; position: relative; }

.visual-inner .img-standard,
.visual-inner .img-blueprint {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: contain;
    padding: 20px;
    box-sizing: border-box;
    transition: opacity 0.3s ease;
}
.visual-inner .img-standard { z-index: 1; opacity: 1; }
.visual-inner .img-blueprint {
    z-index: 2;
    background: #000;
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    animation: scan-reveal 4s ease-in-out infinite alternate;
}
.visual-inner .laser-scan {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 3px;
    background: var(--scan-color);
    box-shadow: 0 0 10px var(--scan-color), 0 0 20px var(--scan-color);
    z-index: 10;
    pointer-events: none;
    animation: scan-move 4s ease-in-out infinite alternate;
}

@keyframes scan-reveal {
    0%   { clip-path: polygon(0 0, 100% 0, 100% 0,    0 0);    }
    100% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
}
@keyframes scan-move {
    0%   { top: 0%;               opacity: 0; }
    5%   { opacity: 1; }
    95%  { opacity: 1; }
    100% { top: calc(100% - 3px); opacity: 0; }
}

.machine-visual:hover .visual-inner .img-blueprint {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    animation-play-state: paused;
    opacity: 1;
}
.machine-visual:hover .visual-inner .img-standard { opacity: 0.15; }
.machine-visual:hover .visual-inner .laser-scan {
    animation-play-state: paused;
    opacity: 1;
    box-shadow: 0 0 15px var(--scan-color), 0 0 30px var(--scan-color), 0 0 50px var(--scan-color);
}

/* -----------------------------------------------------------
   11. MACHINE DETAILS
----------------------------------------------------------- */
.machine-details {
    flex: 1;
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.machine-title {
    font-family: var(--font-primary);
    font-size: 2.2rem;
    color: #fff;
    margin: 0 0 20px 0;
    border-bottom: 2px solid var(--mm-blue);
    padding-bottom: 15px;
    display: inline-block;
    width: fit-content;
}
.machine-desc {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--mm-text-muted);
    margin-bottom: 35px;
}
.spec-table {
    background-color: #222;
    border: 1px solid #444;
    padding: 35px 30px;
    border-radius: 8px;
    margin-bottom: 35px;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    display: block;
}
.spec-table::before {
    content: "Specifications:";
    display: block;
    font-family: var(--font-primary);
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 20px;
}
.spec-table tbody { display: block; width: 100%; }
.spec-table tr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
}
.spec-table tr:last-child { border-bottom: none; }
.spec-label { font-weight: 700; color: #888; font-size: 0.95rem; }
.spec-value { text-align: right; color: #fff; font-family: var(--font-secondary); }

.action-btn {
    display: inline-block;
    background-color: var(--mm-green);
    color: #fff;
    border: none;
    padding: 16px 0;
    width: 100%;
    max-width: 300px;
    font-family: var(--font-primary);
    font-size: 1rem;
    text-transform: uppercase;
    text-decoration: none;
    text-align: center;
    border-radius: 6px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}
.action-btn:hover {
    background-color: #218838;
    box-shadow: 0 0 15px rgba(40, 167, 69, 0.4);
}

/* -----------------------------------------------------------
   12. AI AGENT — FLOATING BUTTON (FAB)
----------------------------------------------------------- */
#ai-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 8000;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 22px rgba(37, 99, 235, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
#ai-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 32px rgba(37, 99, 235, 0.75);
}
#ai-fab svg { width: 26px; height: 26px; fill: #fff; }
#ai-fab::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--mm-accent);
    animation: fab-pulse 2.2s ease-out infinite;
    pointer-events: none;
}
@keyframes fab-pulse {
    0%   { transform: scale(1);    opacity: 0.7; }
    100% { transform: scale(1.65); opacity: 0;   }
}

#ai-fab-tip {
    position: fixed;
    bottom: 42px;
    right: 98px;
    z-index: 8000;
    background: rgba(17, 24, 39, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(59, 130, 246, 0.5);
    color: #93c5fd;
    font-family: var(--font-primary);
    font-size: 0.58rem;
    letter-spacing: 2px;
    padding: 6px 12px;
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(6px);
    transition: opacity 0.2s, transform 0.2s;
}
#ai-fab:hover + #ai-fab-tip { opacity: 1; transform: translateX(0); }

/* ==========================================================================
   SECTION 13: AI AGENT — GLASSMORPHISM CHAT PANEL
========================================================================== */

#ai-panel {
    position: fixed;
    bottom: 102px;
    right: 30px;
    z-index: 8001;
    width: 390px;
    /* Panel height follows content; cap total size — do not force a tall empty flex column */
    max-height: min(580px, calc(100vh - 120px));
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: rgba(8, 14, 30, 0.55);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-top: 3px solid var(--mm-accent);
    box-shadow: 0 10px 44px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(14px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#ai-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
    height: auto;
    max-height: min(680px, calc(100vh - 120px));
}

/* Wider panel when the assistant returns markdown tables (toggled from index.js) */
#ai-panel.wide-response {
    width: 480px;
    max-width: min(480px, calc(100vw - 40px));
}

/* Panel header (matches index.html .ap-hdr) */
.ap-hdr {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.15);
    background: rgba(8, 14, 30, 0.92);
    flex: 0 0 auto;
    flex-shrink: 0;
    position: relative;
    z-index: 3;
}

.ap-hdr .ap-avatar {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.ap-hdr .ap-info {
    flex: 1;
    min-width: 0;
}

.ap-hdr .ap-name {
    font-family: var(--font-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    color: #f9fafb;
}

.ap-hdr .ap-status {
    font-size: 0.68rem;
    color: #9ca3af;
    margin-top: 2px;
}

.ap-hdr .ap-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    margin-right: 4px;
    vertical-align: middle;
}

#ap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.15);
    background: rgba(8, 14, 30, 0.6);
    flex-shrink: 0;
}

#ap-header h3 {
    margin: 0;
    font-size: 0.92rem;
    color: #f9fafb;
    font-family: var(--font-secondary);
    font-weight: 600;
}

#ap-header .status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    color: #4ade80;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: var(--font-primary);
}

#ap-header .status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#ap-close,
.ap-hdr .ap-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    width: 32px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    flex: none;
    flex-shrink: 0;
}

#ap-close:hover {
    color: #f9fafb;
}

/* ═══════════════════════════════════════════════════════════════════════
   SECTION 13.1 MESSAGE BOX — SCROLLABLE AREA (CRITICAL FIX)
═══════════════════════════════════════════════════════════════════════ */

/* Message list: do NOT flex-grow — avoids huge empty band under the greeting when the panel is tall */
#ap-msgs {
    flex: 0 1 auto;
    min-height: 320px;
    max-height: min(520px, calc(100vh - 260px));
    overflow-y: auto;
    overflow-x: auto;
    padding: 14px 10px 14px 14px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.45) rgba(255, 255, 255, 0.08);
}

#ap-msgs:hover {
    scrollbar-color: rgba(59, 130, 246, 0.85) rgba(255, 255, 255, 0.12);
}

#ap-msgs::-webkit-scrollbar {
    width: 8px;
}

#ap-msgs::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.22);
    border-radius: 4px;
}

#ap-msgs::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.42);
    border-radius: 4px;
}

#ap-msgs:hover::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.72);
}

#ap-msgs::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.92);
}

/* ═══════════════════════════════════════════════════════════════════════
   SECTION 13.2 MESSAGE STYLING
═══════════════════════════════════════════════════════════════════════ */

.msg {
    max-width: 90%;
    font-size: 0.84rem;
    line-height: 1.65;
    padding: 10px 13px;
    word-wrap: break-word;
}

.msg.bot {
    background: rgba(15, 29, 48, 0.75);
    border-left: 3px solid var(--mm-accent);
    align-self: flex-start;
    color: #cbd5e1;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    max-width: 100%;
}

/* Tables inside bot messages: horizontal scroll instead of crushing columns */
.msg.bot table {
    border-collapse: collapse;
    font-size: 0.78rem;
    margin: 0.5em 0;
    max-width: 100%;
}

.msg.bot th,
.msg.bot td {
    border: 1px solid rgba(59, 130, 246, 0.35);
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
}

.msg.bot .msg-table-wrap {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.msg.user {
    background: rgba(29, 78, 216, 0.75);
    align-self: flex-end;
    color: #fff;
    border-right: 3px solid #93c5fd;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.msg.err {
    background: rgba(26, 10, 10, 0.75);
    border-left: 3px solid #ef4444;
    align-self: flex-start;
    color: #fca5a5;
    font-size: 0.8rem;
}

/* Typing Indicator */
.msg.typing {
    display: flex;
    gap: 5px;
    align-items: center;
    background: rgba(15, 29, 48, 0.75);
    border-left: 3px solid var(--mm-accent);
    align-self: flex-start;
    padding: 14px 16px;
}

.msg.typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mm-accent);
    animation: tdot 1.2s infinite;
    flex-shrink: 0;
}

.msg.typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.msg.typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes tdot {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    40% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   SECTION 13.3 MESSAGE SOURCES (catalog chips)
═══════════════════════════════════════════════════════════════════════ */

.msg-sources {
    margin-top: 10px;
    border-top: 1px solid rgba(59, 130, 246, 0.2);
    padding-top: 8px;
}

.src-label {
    font-family: var(--font-primary);
    font-size: 0.56rem;
    letter-spacing: 2px;
    color: #9ca3af;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.src-chip {
    display: inline-block;
    font-size: 0.68rem;
    background: rgba(10, 21, 37, 0.65);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
    padding: 3px 9px;
    margin: 2px 3px 2px 0;
    border-radius: 3px;
}

.src-score {
    color: #9ca3af;
    font-size: 0.64rem;
    margin-left: 3px;
}

/* ═══════════════════════════════════════════════════════════════════════
   SECTION 13.4 QUICK CHIPS (predefined questions)
═══════════════════════════════════════════════════════════════════════ */

.ap-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 10px;
    border-top: 1px solid rgba(59, 130, 246, 0.15);
    background: rgba(8, 14, 30, 0.4);
    flex-shrink: 0;
}

.chip {
    font-size: 0.62rem;
    font-family: var(--font-primary);
    letter-spacing: 1px;
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.08);
    padding: 5px 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    border-radius: 2px;
}

.chip:hover {
    background: rgba(59, 130, 246, 0.85);
    color: #fff;
    border-color: var(--mm-accent);
}

.chip:active {
    transform: scale(0.97);
}

/* ═══════════════════════════════════════════════════════════════════════
   SECTION 13.5 INPUT ROW (message input + send button)
═══════════════════════════════════════════════════════════════════════ */

.ap-form {
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    border: none;
    min-width: 0;
}

.ap-input-row {
    display: flex;
    border-top: 1px solid rgba(59, 130, 246, 0.2);
    flex-shrink: 0;
}

.ap-input-row input {
    flex: 1;
    background: rgba(8, 14, 24, 0.65);
    border: none;
    color: #f9fafb;
    font-family: var(--font-secondary);
    font-size: 0.84rem;
    padding: 13px 14px;
    outline: none;
    transition: background 0.2s;
}

.ap-input-row input:focus {
    background: rgba(8, 14, 24, 0.9);
}

.ap-input-row input::placeholder {
    color: #4b5563;
}

.ap-input-row input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#ap-send {
    background: var(--mm-accent);
    border: none;
    color: #fff;
    padding: 0 18px;
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
    font-weight: 600;
}

#ap-send:hover {
    background: var(--mm-accent-dark);
}

#ap-send:active {
    background: #1d4ed8;
}

#ap-send:disabled {
    background: rgba(30, 58, 95, 0.6);
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════════
   SECTION 13.6 PRODUCT LINKS STYLING (Integrated from chatbot-product-links.css)
═══════════════════════════════════════════════════════════════════════ */

.chat-message.product-links {
    background: linear-gradient(135deg, rgba(100, 150, 255, 0.08) 0%, rgba(100, 150, 255, 0.04) 100%);
    border-left: 3px solid #6496ff;
    padding: 12px 16px;
    margin: 12px 0;
    border-radius: 6px;
    font-size: 0.95rem;
}

.chat-message.product-links strong {
    display: block;
    color: #cbd5e1;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.product-links-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.product-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background: rgba(59, 130, 246, 0.1);
    border: 1.5px solid #6496ff;
    border-radius: 20px;
    color: #93c5fd;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.product-link:hover {
    background: #6496ff;
    color: white;
    box-shadow: 0 4px 12px rgba(100, 150, 255, 0.3);
    transform: translateY(-2px);
}

.product-link:active {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    #ai-panel {
        width: 100%;
        max-width: calc(100vw - 20px);
        bottom: 60px;
        right: 10px;
        left: 10px;
        max-height: 70vh;
    }

    #ap-msgs {
        padding: 10px 8px 10px 10px;
        min-height: 200px;
        max-height: min(520px, calc(70vh - 200px));
    }

    #ai-panel.wide-response {
        width: 100%;
        max-width: calc(100vw - 20px);
    }

    .ap-chips {
        padding: 5px 8px;
        gap: 4px;
    }

    .chip {
        font-size: 0.58rem;
        padding: 4px 8px;
    }

    .msg {
        font-size: 0.78rem;
        padding: 8px 10px;
    }

    .product-links-container {
        gap: 6px;
    }

    .product-link {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* -----------------------------------------------------------
   14. RESPONSIVE
----------------------------------------------------------- */
@media (max-width: 992px) {
    .machine-row,
    .machine-row:nth-child(even) { flex-direction: column; height: auto; }
    .machine-visual  { height: 400px; }
    .machine-details { padding: 30px; }
    .img-standard, .img-blueprint { padding: 10px; }
}

@media (max-width: 600px) {
    .machine-title { font-size: 1.5rem; }
    .machine-desc  { font-size: 0.95rem; }
    #ai-panel   { width: calc(100vw - 16px); right: 8px; bottom: 88px; }
    #ai-fab     { right: 16px; bottom: 18px; }
    #ai-fab-tip { right: 82px; }
}

/* -----------------------------------------------------------
   15. CATEGORY HUB GRID  (index.html)
----------------------------------------------------------- */
/* ── Outer section wrapper ── */
.cat-hub-section {
    width: 100%;
    background-color: var(--mm-dark-bg);
    padding-bottom: 60px;
}

/* ── Section Header Bar ── */
.cat-hub-header {
    width: 100%;
    background: #111827;
    border-bottom: 1px solid #1e2d40;
    border-top: 1px solid #1e2d40;
}

.cat-hub-header-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 5%;
    gap: 40px;
}

/* Left: text block */
.cat-hub-header-text {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    text-align: center;
}

.cat-hub-eyebrow {
    font-family: var(--font-primary);
    font-size: 2rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--mm-accent);
    margin: 0;
}

.cat-hub-title {
    font-family: var(--font-primary);
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #f9fafb;
    margin: 0;
    line-height: 1.05;
}

.cat-hub-subtitle {
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: #9ca3af;
    line-height: 1.65;
    margin: 4px 0 0;
    max-width: 600px;
}

/* Right: decorative accent */
.cat-hub-header-accent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.accent-line {
    width: 2px;
    height: 40px;
    background: linear-gradient(to bottom, transparent, var(--mm-accent), transparent);
}

.accent-count {
    font-family: var(--font-primary);
    font-size: 0.6rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--mm-accent);
    white-space: nowrap;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

/* ── Grid ── */
.cat-hub-grid {
    width: 100%;
    padding: 40px 3% 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.8%;
    box-sizing: border-box;
}

/* ── Card shell ── */
.cat-hub-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: var(--mm-panel);
    border: 1px solid var(--mm-border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.cat-hub-card:hover {
    transform: translateY(-6px);
    border-color: var(--mm-accent);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
}

/* ── Visual area ── */
.cat-hub-visual {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.cat-hub-visual .img-standard,
.cat-hub-visual .img-blueprint {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: opacity 0.3s ease;
    background: #000;
}

.cat-hub-visual .img-standard { z-index: 1; opacity: 1; }

.cat-hub-visual .img-blueprint {
    z-index: 2;
    background: #000;
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    animation: scan-reveal 4s ease-in-out infinite alternate;
}

.cat-hub-visual .laser-scan {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 3px;
    background: var(--scan-color);
    box-shadow: 0 0 10px var(--scan-color), 0 0 20px var(--scan-color);
    z-index: 10;
    pointer-events: none;
    animation: scan-move 4s ease-in-out infinite alternate;
}

/* Hover */
.cat-hub-card:hover .cat-hub-visual .img-blueprint {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    animation-play-state: paused;
    opacity: 1;
}
.cat-hub-card:hover .cat-hub-visual .img-standard { opacity: 0.12; }
.cat-hub-card:hover .cat-hub-visual .laser-scan {
    animation-play-state: paused;
    opacity: 1;
    box-shadow: 0 0 15px var(--scan-color), 0 0 30px var(--scan-color), 0 0 50px var(--scan-color);
}

/* ── Label area ── */
.cat-hub-label {
    padding: 20px 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}
.cat-hub-label h3 {
    font-family: var(--font-primary);
    font-size: clamp(0.75rem, 1.1vw, 1rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #f9fafb;
    margin: 0;
    transition: color 0.2s;
}
.cat-hub-card:hover .cat-hub-label h3 { color: var(--mm-accent); }

.cat-hub-label p {
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    color: #9ca3af;
    line-height: 1.55;
    margin: 0;
}

.cat-hub-cta {
    display: inline-block;
    margin-top: 8px;
    font-family: var(--font-primary);
    font-size: clamp(0.55rem, 0.65vw, 0.65rem);
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--mm-accent);
    transition: letter-spacing 0.2s;
}
.cat-hub-card:hover .cat-hub-cta { letter-spacing: 4px; }

/* ── Responsive ── */
@media (max-width: 960px) {
    .cat-hub-grid { grid-template-columns: repeat(2, 1fr); padding: 30px 4% 0; gap: 3%; }
    .cat-hub-header-accent { display: none; }
    .cat-hub-title { font-size: clamp(1.8rem, 5vw, 2.8rem); }
}
@media (max-width: 560px) {
    .cat-hub-grid { grid-template-columns: 1fr; padding: 20px 5% 0; gap: 4%; }
    .cat-hub-header-inner { padding: 32px 5%; }
}