/*
 * footer.css — QDPlywood.com Global Footer Styles
 *
 * Design tokens sourced from DNA.md:
 *   primary:       #1A2E1A  (forest green dark)
 *   primary-light: #2D4A2D
 *   primary-950:   #0D1A0D
 *   cta:           #2E7D32
 *   cta-light:     #4CAF50
 *   accent:        #8D6E63
 *   wood-300:      #D4B896
 *   wood-200:      #E8D5C0
 *   neutral-400:   #8AAA8A
 *   neutral-500:   #5E7E5E
 *
 * Container: max-w-[1440px] with px-4 sm:px-5 lg:px-6 gutters
 * (matches site-wide shell — not 1280px)
 *
 * Zero inline styles in footer.php — all visual logic lives here.
 */

/* ============================================================
   DESIGN TOKENS (CSS custom properties)
   ============================================================ */
:root {
    --ft-bg:            #1A2E1A;
    --ft-bg-deep:       #0D1A0D;
    --ft-bg-mid:        #2D4A2D;
    --ft-cta:           #2E7D32;
    --ft-cta-light:     #4CAF50;
    --ft-accent:        #8D6E63;
    --ft-wood-200:      #E8D5C0;
    --ft-wood-300:      #D4B896;
    --ft-text-primary:  #ffffff;
    --ft-text-muted:    rgba(255, 255, 255, 0.60);
    --ft-text-faint:    rgba(255, 255, 255, 0.35);
    --ft-border:        rgba(255, 255, 255, 0.08);
    --ft-border-mid:    rgba(255, 255, 255, 0.12);
    --ft-radius:        4px;
    --ft-radius-md:     6px;
    --ft-radius-lg:     8px;
    --ft-shell-max:     1440px;
    --ft-shell-px:      1rem;       /* base: px-4 */
    --ft-transition:    0.2s ease;

    /* WhatsApp panel */
    --wa-bg:            #f5f0eb;
    --wa-header-bg:     #1A2E1A;
    --wa-bubble-bg:     #ffffff;
    --wa-submit-bg:     #25D366;
    --wa-submit-hover:  #1da851;
    --wa-border:        #ddd5c8;
    --wa-text:          #2a2a2a;
    --wa-text-muted:    #6b6b6b;
    --wa-input-focus:   #2E7D32;
    --wa-panel-w:       360px;
    --wa-panel-radius:  12px;
    --wa-z:             9000;
    --wa-fab-z:         9001;
}

@media (min-width: 640px) {
    :root { --ft-shell-px: 1.25rem; } /* sm:px-5 */
}
@media (min-width: 1024px) {
    :root { --ft-shell-px: 1.5rem; }  /* lg:px-6 */
}


/* ============================================================
   FOOTER ROOT
   ============================================================ */
.ft-root {
    position: relative;
    background-color: var(--ft-bg);
    color: var(--ft-text-primary);
    font-family: 'Inter', system-ui, sans-serif;
    overflow: hidden;
}

/* Wood-grid texture overlay (DNA.md dark section pattern) */
.ft-wood-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 0;
}

/* All direct children sit above the texture */
.ft-upper,
.ft-legal-bar {
    position: relative;
    z-index: 1;
}


/* ============================================================
   SHELL (1440px max-width, responsive gutters)
   ============================================================ */
.ft-shell {
    max-width: var(--ft-shell-max);
    margin-inline: auto;
    padding-inline: var(--ft-shell-px);
}


/* ============================================================
   UPPER FOOTER
   ============================================================ */
.ft-upper {
    padding-top: 5rem;
    padding-bottom: 4rem;
    border-bottom: 1px solid var(--ft-border);
}

/* 4-column grid: brand (wider) + 3 nav columns */
.ft-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
}

@media (min-width: 640px) {
    .ft-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2.5rem 3rem;
    }
}

@media (min-width: 1024px) {
    .ft-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
        gap: 3rem 4rem;
        align-items: start;
    }
}


/* ============================================================
   BRAND COLUMN
   ============================================================ */
.ft-col-brand {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Logo sizing: confident enterprise presence, responsive */
.ft-logo-link {
    display: inline-block;
    line-height: 0;
}

.ft-logo {
    width: clamp(132px, 14vw, 188px);
    height: auto;
    display: block;
}

/* Tagline */
.ft-tagline {
    font-size: 0.8125rem;
    line-height: 1.65;
    color: var(--ft-text-muted);
    max-width: 30ch;
}

/* Certification badges */
.ft-cert-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ft-cert-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--ft-border-mid);
    border-radius: var(--ft-radius);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--ft-wood-300);
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.04);
}

/* Contact list */
.ft-contact-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ft-contact-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    font-size: 0.8125rem;
    color: var(--ft-text-muted);
    line-height: 1.5;
}

.ft-contact-list a {
    color: var(--ft-text-muted);
    text-decoration: none;
    transition: color var(--ft-transition);
}

.ft-contact-list a:hover,
.ft-contact-list a:focus-visible {
    color: var(--ft-text-primary);
}

.ft-contact-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
    color: var(--ft-wood-300);
}

.ft-contact-icon--wa {
    color: #25D366;
}

.ft-wa-inline-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ft-text-muted);
    text-decoration: none;
    transition: color var(--ft-transition);
}

.ft-wa-inline-link:hover,
.ft-wa-inline-link:focus-visible {
    color: #25D366;
}


/* ============================================================
   NAV COLUMNS
   ============================================================ */
.ft-col-nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ft-col-heading {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ft-wood-300);
    margin: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--ft-border);
}

.ft-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.ft-nav-link {
    font-size: 0.8125rem;
    color: var(--ft-text-muted);
    text-decoration: none;
    transition: color var(--ft-transition), padding-left var(--ft-transition);
    display: inline-block;
}

.ft-nav-link:hover,
.ft-nav-link:focus-visible {
    color: var(--ft-text-primary);
    padding-left: 0.25rem;
}


/* ============================================================
   LEGAL BAR
   ============================================================ */
.ft-legal-bar {
    background-color: var(--ft-bg-deep);
    border-top: 1px solid var(--ft-border);
}

.ft-legal-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.875rem;
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
    text-align: center;
}

@media (min-width: 768px) {
    .ft-legal-inner {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

.ft-copyright {
    font-size: 0.75rem;
    color: var(--ft-text-faint);
    margin: 0;
    white-space: nowrap;
}

.ft-legal-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 1.25rem;
}

@media (min-width: 768px) {
    .ft-legal-nav {
        justify-content: flex-end;
    }
}

.ft-legal-link {
    font-size: 0.75rem;
    color: var(--ft-text-faint);
    text-decoration: none;
    transition: color var(--ft-transition);
    white-space: nowrap;
}

.ft-legal-link:hover,
.ft-legal-link:focus-visible {
    color: var(--ft-text-muted);
}


/* ============================================================
   FLOATING ACTION BUTTONS (FAB STACK)
   ============================================================ */
.ft-fab-stack {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: var(--wa-fab-z);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
}

/* Base FAB */
.ft-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        opacity 0.25s ease;
    position: relative;
}

.ft-fab:focus-visible {
    outline: 2px solid var(--ft-cta-light);
    outline-offset: 3px;
}

/* Back-to-top FAB */
.ft-fab--top {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background-color: var(--ft-bg-mid);
    color: var(--ft-text-primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translateY(0.5rem);
    pointer-events: none;
}

.ft-fab--top svg {
    width: 1.125rem;
    height: 1.125rem;
}

.ft-fab--top.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.ft-fab--top:hover {
    background-color: var(--ft-cta);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* WhatsApp FAB */
.ft-fab--wa {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    background-color: #25D366;
    color: #ffffff;
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.45);
}

.ft-fab--wa svg {
    width: 1.625rem;
    height: 1.625rem;
    position: relative;
    z-index: 1;
}

.ft-fab--wa:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 28px rgba(37, 211, 102, 0.55);
}

/* Pulse ring on WA FAB */
.ft-fab-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background-color: #25D366;
    animation: ft-pulse-ring 2.4s ease-out infinite;
    z-index: 0;
}

@keyframes ft-pulse-ring {
    0%   { transform: scale(1);    opacity: 0.55; }
    70%  { transform: scale(1.55); opacity: 0; }
    100% { transform: scale(1.55); opacity: 0; }
}


/* ============================================================
   WHATSAPP CHAT PANEL
   Anchored bottom-right, chat-widget style
   ============================================================ */
.wa-panel {
    position: fixed;
    bottom: calc(1.5rem + 3.25rem + 0.625rem + 2.75rem + 0.625rem + 0.5rem);
    /* stacks above the FAB stack: bottom + wa-fab-h + gap + top-fab-h + gap + breathing */
    right: 1.5rem;
    width: var(--wa-panel-w);
    max-width: calc(100vw - 2rem);
    background-color: var(--wa-bg);
    border-radius: var(--wa-panel-radius);
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.07),
        0 12px 40px rgba(0, 0, 0, 0.18);
    z-index: var(--wa-z);
    overflow: hidden;

    /* Hidden state */
    opacity: 0;
    visibility: hidden;
    transform: translateY(1.25rem) scale(0.97);
    transform-origin: bottom right;
    transition:
        opacity 0.28s ease,
        visibility 0.28s ease,
        transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Open state — toggled by footer.js */
.wa-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .wa-panel {
        transition: opacity 0.15s ease, visibility 0.15s ease;
        transform: none;
    }
    .wa-panel.is-open {
        transform: none;
    }
    .ft-fab-pulse {
        animation: none;
    }
}


/* ── Panel header ── */
.wa-panel__header {
    background-color: var(--wa-header-bg);
    padding: 1rem 1.125rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.wa-panel__header-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.wa-panel__avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background-color: #25D366;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wa-panel__avatar svg {
    width: 1.375rem;
    height: 1.375rem;
    color: #ffffff;
}

.wa-panel__header-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.wa-panel__name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-panel__status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
}

.wa-panel__status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background-color: #25D366;
    flex-shrink: 0;
    animation: wa-status-pulse 2.2s ease-in-out infinite;
}

@keyframes wa-status-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}

.wa-panel__close {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.25rem;
    border-radius: var(--ft-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color var(--ft-transition), background-color var(--ft-transition);
}

.wa-panel__close svg {
    width: 1.125rem;
    height: 1.125rem;
}

.wa-panel__close:hover,
.wa-panel__close:focus-visible {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.12);
}

.wa-panel__close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}


/* ── Panel body ── */
.wa-panel__body {
    padding: 1.25rem 1.125rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 60vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Scrollbar styling */
.wa-panel__body::-webkit-scrollbar {
    width: 4px;
}
.wa-panel__body::-webkit-scrollbar-track {
    background: transparent;
}
.wa-panel__body::-webkit-scrollbar-thumb {
    background: var(--wa-border);
    border-radius: 2px;
}


/* ── Welcome bubble ── */
.wa-panel__bubble {
    background-color: var(--wa-bubble-bg);
    border-radius: 0 0.75rem 0.75rem 0.75rem;
    padding: 0.875rem 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    position: relative;
    max-width: 90%;
}

.wa-panel__bubble p {
    margin: 0 0 0.375rem;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--wa-text);
}

.wa-panel__bubble-time {
    font-size: 0.6875rem;
    color: var(--wa-text-muted);
    display: block;
    text-align: right;
}


/* ── Lead-gate form ── */
.wa-panel__form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.wa-panel__field-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.wa-panel__label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--wa-text);
    letter-spacing: 0.01em;
}

.wa-panel__label span {
    color: #c0392b;
}

.wa-panel__input,
.wa-panel__textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1.5px solid var(--wa-border);
    border-radius: var(--ft-radius-md);
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--wa-text);
    background-color: #ffffff;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.wa-panel__input:focus,
.wa-panel__textarea:focus {
    border-color: var(--wa-input-focus);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

.wa-panel__input.has-error,
.wa-panel__textarea.has-error {
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

.wa-panel__textarea {
    resize: vertical;
    min-height: 5rem;
    line-height: 1.5;
}

.wa-panel__field-error {
    font-size: 0.6875rem;
    color: #c0392b;
    min-height: 1em;
    display: block;
}

/* Submit button */
.wa-panel__submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--wa-submit-bg);
    color: #ffffff;
    border: none;
    border-radius: 2rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
    box-shadow: 0 3px 12px rgba(37, 211, 102, 0.35);
    margin-top: 0.25rem;
}

.wa-panel__submit svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.wa-panel__submit:hover {
    background-color: var(--wa-submit-hover);
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(37, 211, 102, 0.45);
}

.wa-panel__submit:active {
    transform: translateY(0);
}

.wa-panel__submit:focus-visible {
    outline: 2px solid var(--wa-submit-bg);
    outline-offset: 3px;
}

.wa-panel__submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}


/* ── Panel footer ── */
.wa-panel__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.125rem 0.75rem;
    border-top: 1px solid var(--wa-border);
    background-color: rgba(255, 255, 255, 0.5);
}

.wa-panel__online-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background-color: #25D366;
    flex-shrink: 0;
    animation: wa-status-pulse 2.2s ease-in-out infinite;
}

.wa-panel__online-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #25D366;
}

.wa-panel__footer-sep {
    font-size: 0.6875rem;
    color: var(--wa-border);
}

/* Mini logo: light-surface, sized for panel footer */
.wa-panel__mini-logo {
    width: clamp(72px, 9vw, 96px);
    height: auto;
    display: block;
}


/* ============================================================
   MOBILE ADJUSTMENTS
   ============================================================ */
@media (max-width: 479px) {
    .ft-upper {
        padding-top: 3rem;
        padding-bottom: 2.5rem;
    }

    .ft-fab-stack {
        bottom: 1rem;
        right: 1rem;
    }

    .wa-panel {
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
        max-width: none;
        bottom: calc(1rem + 3.25rem + 0.625rem + 2.75rem + 0.625rem + 0.5rem);
    }

    .ft-logo {
        width: clamp(110px, 36vw, 148px);
    }

    .wa-panel__mini-logo {
        width: clamp(64px, 20vw, 88px);
    }
}
