/* ============================================================
   Boston Template Library — Frontend Styles
   v2.1 — Card footer + full mobile responsive
   ============================================================ */

:root {
    --btl-accent:       #f0b429;
    --btl-accent-dark:  #d49a20;
    --btl-green:        #25D366;   /* WhatsApp brand green */
    --btl-green-dark:   #128C7E;   /* WhatsApp dark green */
    --btl-green-light:  #dcf8c6;   /* WhatsApp light bg */
    --btl-call-bg:      #f7af24;   /* Call button background */
    --btl-call-border:  #18171C;   /* Call button border */
    --btl-call-text:    #18171C;   /* Call button text */
    --btl-call-hover:   #e09d10;   /* Call button hover bg */
    --btl-dark:         #1a1a2e;
    --btl-text:         #2d3748;
    --btl-muted:        #718096;
    --btl-border:       #e2e8f0;
    --btl-bg:           #f7fafc;
    --btl-card-bg:      #ffffff;
    --btl-radius:       12px;
    --btl-radius-sm:    8px;
    --btl-shadow:       0 2px 12px rgba(0,0,0,.07);
    --btl-shadow-hover: 0 10px 32px rgba(0,0,0,.14);
    --btl-transition:   .22s ease;
}

/* ── Base reset (scoped to all BTL elements) ─────────────── */
[class*="btl-"],
[class*="btl-"] *,
[class*="btl-"] *::before,
[class*="btl-"] *::after {
    box-sizing: border-box;
}

/* ── Section Header ──────────────────────────────────────── */
.btl-section-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 0 16px;
}
.btl-section-title {
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    font-weight: 700;
    color: var(--btl-dark);
    margin: 0 0 10px;
    line-height: 1.2;
}
.btl-section-subtitle {
    font-size: 1rem;
    color: var(--btl-muted);
    margin: 0 auto;
    max-width: 480px;
}

/* ── Industry Grid ───────────────────────────────────────── */
.btl-industries-section { padding: 32px 0; width: 100%; }

.btl-industries-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    min-width: 0;
}
.btl-industries-grid.btl-cols-2 { grid-template-columns: repeat(2, 1fr); }
.btl-industries-grid.btl-cols-3 { grid-template-columns: repeat(3, 1fr); }
.btl-industries-grid.btl-cols-4 { grid-template-columns: repeat(4, 1fr); }

.btl-industry-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--btl-card-bg);
    border: 1px solid var(--btl-border);
    border-left: 4px solid var(--btl-accent);
    border-radius: var(--btl-radius);
    text-decoration: none;
    color: var(--btl-text);
    transition: var(--btl-transition);
    position: relative;
    overflow: hidden;
}
.btl-industry-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--btl-accent);
    opacity: 0;
    transition: var(--btl-transition);
}
.btl-industry-card:hover,
.btl-industry-card:focus {
    box-shadow: var(--btl-shadow-hover);
    text-decoration: none;
    color: var(--btl-dark);
}
.btl-industry-card:hover::before { opacity: .05; }
.btl-industry-icon {
    font-size: 1.8rem;
    line-height: 1;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.btl-industry-info { flex: 1; position: relative; z-index: 1; min-width: 0; }
.btl-industry-name {
    font-size: .95rem;
    font-weight: 600;
    margin: 0 0 3px;
    color: var(--btl-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.btl-industry-count { font-size: .78rem; color: var(--btl-muted); }
.btl-industry-arrow {
    font-size: 1.1rem;
    color: var(--btl-muted);
    transition: var(--btl-transition);
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}
.btl-industry-card:hover .btl-industry-arrow {
    color: var(--btl-accent);
    transform: translateX(4px);
}
.btl-explore-wrap { text-align: center; margin-top: 32px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--btl-radius-sm);
    font-size: .875rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: var(--btl-transition);
    border: 2px solid transparent;
    white-space: nowrap;
}
.btl-btn-primary {
    background: var(--btl-accent);
    color: #1a1a1a;
    border-color: var(--btl-accent);
}
.btl-btn-primary:hover {
    background: var(--btl-accent-dark);
    border-color: var(--btl-accent-dark);
    color: #1a1a1a;
    text-decoration: none;
}
.btl-btn-outline {
    background: transparent;
    color: #fff;
    border-color: rgba(255,255,255,.6);
}
.btl-btn-outline:hover {
    background: rgba(255,255,255,.15);
    border-color: #fff;
    color: #fff;
    text-decoration: none;
}
/* Override for buttons on light backgrounds (Load More, Explore All) */
.btl-load-more-wrap .btl-btn-outline,
.btl-explore-wrap .btl-btn-outline {
    color: var(--btl-dark);
    border-color: var(--btl-dark);
    background: transparent;
}
.btl-load-more-wrap .btl-btn-outline:hover,
.btl-explore-wrap .btl-btn-outline:hover {
    background: var(--btl-dark);
    color: #fff;
    text-decoration: none;
}
.btl-btn-dark-outline {
    background: transparent;
    color: var(--btl-dark);
    border-color: var(--btl-dark);
}
.btl-btn-dark-outline:hover {
    background: var(--btl-dark);
    color: #fff;
    text-decoration: none;
}
.btl-btn-sm { padding: 7px 14px; font-size: .8rem; }

/* ── Overlay top (Live Preview only) ─────────────────────── */
.btl-overlay-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0 16px;
}

/* ── Filter Bar ──────────────────────────────────────────── */
.btl-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background: var(--btl-bg);
    border: 1px solid var(--btl-border);
    border-radius: var(--btl-radius);
    padding: 14px 18px;
    margin-bottom: 24px;
}
.btl-filter-search {
    flex: 1 1 160px;
    min-width: 0;
}
.btl-filter-search input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    border: 1px solid var(--btl-border);
    border-radius: var(--btl-radius-sm);
    font-size: .875rem;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23718096' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 10px center;
    background-size: 16px;
    outline: none;
    transition: var(--btl-transition);
}
.btl-filter-search input:focus {
    border-color: var(--btl-accent);
    box-shadow: 0 0 0 3px rgba(240,180,41,.15);
}
.btl-filter-dropdowns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 2 1 auto;
}
.btl-select {
    flex: 1 1 120px;
    padding: 9px 12px;
    border: 1px solid var(--btl-border);
    border-radius: var(--btl-radius-sm);
    font-size: .875rem;
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: var(--btl-transition);
    min-width: 0;
    max-width: 200px;
}
.btl-select:focus { border-color: var(--btl-accent); }
.btl-filter-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.btl-result-count {
    font-size: .82rem;
    color: var(--btl-muted);
    white-space: nowrap;
}
.btl-btn-reset {
    background: none;
    border: 1px solid var(--btl-border);
    border-radius: 6px;
    padding: 7px 12px;
    font-size: .8rem;
    cursor: pointer;
    color: var(--btl-muted);
    transition: var(--btl-transition);
    white-space: nowrap;
}
.btl-btn-reset:hover { background: #fff; color: var(--btl-text); border-color: #aaa; }

/* ── Templates Grid ──────────────────────────────────────── */
.btl-templates-section { width: 100%; min-width: 0; }
.btl-templates-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    min-width: 0;
    min-height: 200px;
    transition: opacity .2s;
}
.btl-templates-grid.btl-cols-2 { grid-template-columns: repeat(2, 1fr); }
.btl-templates-grid.btl-cols-3 { grid-template-columns: repeat(3, 1fr); }
.btl-templates-grid.btl-cols-4 { grid-template-columns: repeat(4, 1fr); }
.btl-templates-grid.btl-loading { opacity: .35; pointer-events: none; }

/* ── Template Card ───────────────────────────────────────── */
.btl-template-card {
    background: var(--btl-card-bg);
    border-radius: var(--btl-radius);
    overflow: hidden;
    box-shadow: var(--btl-shadow);
    transition: transform var(--btl-transition), box-shadow var(--btl-transition);
    border: 1px solid var(--btl-border);
    display: flex;
    flex-direction: column;
}
/* Only lift on true hover-capable devices — prevents layout shift on touch tap */
@media (hover: hover) and (pointer: fine) {
    .btl-template-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--btl-shadow-hover);
    }
}
.btl-card-image {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--btl-bg);
    flex-shrink: 0;
}
.btl-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}
.btl-card-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 2.5rem;
    color: var(--btl-border);
}

/* Overlay — desktop hover only, Live Preview button */
.btl-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(20, 20, 40, .78);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    transition: opacity var(--btl-transition);
    padding: 16px;
}
.btl-template-card:hover .btl-card-overlay { opacity: 1; }

/* Badges */
.btl-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--btl-accent);
    color: #1a1a1a;
    font-size: .68rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .5px;
    z-index: 2;
}
.btl-badge-popular  { background: #e53e3e; color: #fff; }
.btl-badge-featured { background: #6b46c1; color: #fff; }
.btl-badge-new      { background: #38a169; color: #fff; }
.btl-free-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #38a169;
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    z-index: 2;
}

/* ── Card Body ───────────────────────────────────────────── */
.btl-card-body {
    padding: 12px 14px 10px;
    flex: 1;
}
.btl-card-body-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}
.btl-card-title {
    font-size: .9rem;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--btl-dark);
    line-height: 1.45;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    /* No clamping — show full title */
}
/* Title is a clickable link to live preview */
.btl-title-link {
    color: inherit;
    text-decoration: none;
    display: block;
}
.btl-title-link:hover {
    color: var(--btl-accent-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.btl-card-industry {
    font-size: .72rem;
    background: var(--btl-bg);
    color: var(--btl-muted);
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
    display: inline-block;
    border: 1px solid var(--btl-border);
    align-self: flex-start;
}

/* ── Card Footer — Call + WhatsApp always visible ────────── */
.btl-card-footer {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--btl-border);
    padding: 8px 10px;
    gap: 8px;
}

.btl-footer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--btl-radius-sm);
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
    transition: filter var(--btl-transition);
    white-space: nowrap;
    line-height: 1;
    border: 1px solid transparent;
    cursor: pointer;
}
.btl-footer-btn:hover {
    text-decoration: none;
    filter: brightness(0.9);
}
.btl-footer-btn svg {
    flex-shrink: 0;
}

/* Call button — #f7af24 bg, #18171C border + text */
a.btl-footer-btn.btl-footer-btn-call {
    background-color: #f7af24;
    border-color: #18171C;
    color: #18171C;
    padding: 8px 14px;
}
a.btl-footer-btn.btl-footer-btn-call:hover {
    color: #18171C;
}

/* WhatsApp button — green scheme */
a.btl-footer-btn.btl-footer-btn-whatsapp {
    background-color: #01c501;
    border-color: #019001;
    color: #ffffff;
    padding: 8px 14px;
}
a.btl-footer-btn.btl-footer-btn-whatsapp:hover {
    color: #ffffff;
}

/* When only one button exists, stretch full width */
.btl-card-footer .btl-footer-btn:only-child {
    width: 100%;
    justify-content: center;
}

/* ── No Results ──────────────────────────────────────────── */
.btl-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    color: var(--btl-muted);
}
.btl-no-results span { font-size: 2.8rem; display: block; margin-bottom: 10px; }
.btl-no-results p { font-size: 1rem; margin: 0; }

/* ── Load More ───────────────────────────────────────────── */
.btl-load-more-wrap { text-align: center; margin-top: 36px; padding-bottom: 8px; }

/* ── Archive header ──────────────────────────────────────── */
.btl-archive-wrap {
    width: 100%;
    overflow-x: hidden;
}
.btl-archive-header {
    background: linear-gradient(135deg, var(--btl-dark) 0%, #2d3561 100%);
    color: #fff;
    padding: 48px 20px;
    margin-bottom: 40px;
}
.btl-archive-header-inner {
    max-width: 880px;
    margin: 0 auto;
}
.btl-archive-header h1 {
    font-size: clamp(1.5rem, 4vw, 2.6rem);
    margin: 10px 0 8px;
    color: #fff;
    line-height: 1.2;
}
.btl-archive-header p { color: rgba(255,255,255,.78); margin: 0; font-size: 1rem; }
.btl-archive-header strong { color: #fff; }
.btl-archive-content {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px 60px;
    overflow-x: hidden;
}
.btl-breadcrumb { font-size: .82rem; color: rgba(255,255,255,.55); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.btl-breadcrumb a { color: var(--btl-accent); text-decoration: none; }
.btl-breadcrumb a:hover { text-decoration: underline; }
.btl-breadcrumb-sep { opacity: .5; }
.btl-industry-header-icon { font-size: 3rem; margin: 14px 0 6px; display: block; }

/* =====================================================================
   RESPONSIVE BREAKPOINTS
   ===================================================================== */

/* ── Large tablets (≤ 1024px): 4-col → 3-col ─────────────────────── */
@media (max-width: 1024px) {
    .btl-industries-grid.btl-cols-4,
    .btl-templates-grid.btl-cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ── Tablets (≤ 768px): 3-col → 2-col ───────────────────────────── */
@media (max-width: 768px) {
    .btl-industries-grid.btl-cols-3,
    .btl-industries-grid.btl-cols-4,
    .btl-templates-grid,
    .btl-templates-grid.btl-cols-3,
    .btl-templates-grid.btl-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .btl-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 14px;
    }
    .btl-filter-search { min-width: 0; width: 100%; flex: 1 1 100%; }
    .btl-filter-search input { padding-left: 36px; width: 100%; }
    .btl-filter-dropdowns { flex-direction: column; }
    .btl-select { max-width: 100% !important; min-width: 0 !important; width: 100%; }
    .btl-filter-meta { justify-content: space-between; }

    /* Hide hover overlay on touch — footer buttons handle CTA */
    .btl-card-overlay { display: none; }

    .btl-archive-header { padding: 36px 16px; }
    .btl-archive-content { padding: 0 14px 48px; }
    .btl-section-header { margin-bottom: 28px; }
    .btl-industry-header-icon { font-size: 2.4rem; }

    /* Footer buttons — keep padding consistent on touch */
    a.btl-footer-btn.btl-footer-btn-call,
    a.btl-footer-btn.btl-footer-btn-whatsapp { padding: 8px 10px; }
}

/* ── Mobile (≤ 480px): 2-col → 1-col ────────────────────────────── */
@media (max-width: 480px) {
    .btl-industries-grid,
    .btl-templates-grid,
    .btl-templates-grid.btl-cols-2 {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .btl-industry-card { padding: 14px 16px; }
    .btl-industry-icon { font-size: 1.5rem; }
    /* Allow name to wrap on 1-col layout — no truncation needed */
    .btl-industry-name { white-space: normal; overflow: visible; text-overflow: unset; }

    .btl-card-image { aspect-ratio: 16/9; }

    .btl-archive-header { padding: 28px 14px; margin-bottom: 24px; }
    .btl-archive-header h1 { font-size: 1.4rem; }
    .btl-archive-content { padding: 0 12px 40px; }
    .btl-industry-header-icon { font-size: 2rem; margin: 10px 0 4px; }

    .btl-btn { padding: 9px 16px; font-size: .82rem; }
    .btl-load-more-wrap { margin-top: 24px; }

    .btl-section-title { font-size: 1.5rem; }
    .btl-section-subtitle { font-size: .9rem; }

    /* Footer buttons compact on small screens */
    a.btl-footer-btn.btl-footer-btn-call,
    a.btl-footer-btn.btl-footer-btn-whatsapp { padding: 8px; font-size: .78rem; }
}

/* ── Very small (≤ 360px) ────────────────────────────────── */
@media (max-width: 360px) {
    .btl-card-body { padding: 10px 12px 8px; }
    .btl-card-title { font-size: .85rem; }
    a.btl-footer-btn.btl-footer-btn-call,
    a.btl-footer-btn.btl-footer-btn-whatsapp { padding: 8px 6px; font-size: .74rem; }
}

/* ── Hover-capable devices: show overlay + lift — not touch ─ */
@media (hover: hover) and (pointer: fine) {
    .btl-card-overlay { display: flex; }
    .btl-template-card:hover .btl-card-image img { transform: scale(1.04); }
    .btl-industry-card:hover { transform: translateY(-3px); }
}
