/* =============================================================
   Tile Gallery Plugin v2.0 — Gallery + Detail
   ============================================================= */

/* ---------------------------------------------------------------
   SHARED utilities
--------------------------------------------------------------- */
.tg-wrapper,
.td-wrapper { font-family: inherit; width: 100%; }

/* Finish badge colours (shared by both widgets) */
.tg-finish-badge,
.tg-finish-polish,
.tg-finish-matt,
.tg-finish-satin,
.tg-finish-custom,
.tg-finish-polish_matt,
.td-tab-btn.tg-finish-polish,
.td-tab-btn.tg-finish-matt,
.td-tab-btn.tg-finish-satin,
.td-tab-btn.tg-finish-custom,
.td-tab-btn.tg-finish-polish_matt,
.td-single-finish-label { display:inline-block; font-size:11px; font-weight:700; padding:3px 10px; border-radius:4px; letter-spacing:.06em; text-transform:uppercase; }

.tg-finish-polish,
.td-tab-btn.tg-finish-polish       { background:#EFF6FF; color:#1E40AF; }
.tg-finish-matt,
.td-tab-btn.tg-finish-matt         { background:#F3F4F6; color:#374151; }
.tg-finish-satin,
.td-tab-btn.tg-finish-satin        { background:#F5F3FF; color:#5B21B6; }
.tg-finish-custom,
.td-tab-btn.tg-finish-custom       { background:#FEF3C7; color:#92400E; }
.tg-finish-polish_matt,
.td-tab-btn.tg-finish-polish_matt  { background:#E0F2FE; color:#0369A1; }

/* ---------------------------------------------------------------
   GALLERY WIDGET — .tg-wrapper
--------------------------------------------------------------- */
.tg-header { margin-bottom: 28px; }
.tg-header-title { font-size: 28px; font-weight: 600; line-height: 1.2; margin: 0 0 8px; color: #111827; }
.tg-header-sub   { font-size: 15px; color: #6B7280; margin: 0; line-height: 1.6; }

/* Filter bar */
.tg-filter-bar { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:24px; }
.tg-filter-btn { padding:6px 18px; border:1px solid #E5E7EB; border-radius:20px; background:#fff; font-size:13px; font-weight:500; color:#6B7280; cursor:pointer; transition:all .18s ease; font-family:inherit; }
.tg-filter-btn:hover { border-color:#9CA3AF; color:#111827; }
.tg-filter-btn.tg-active { background:#111827; border-color:#111827; color:#fff; }

/* Grid */
.tg-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; }
.tg-card { position:relative; background:#fff; border:1px solid #E5E7EB; border-radius:10px; overflow:hidden; cursor:pointer; text-decoration:none; transition:transform .2s ease, box-shadow .2s ease, border-color .18s ease; display:block; }
.tg-card:hover { transform:translateY(-3px); box-shadow:0 8px 24px rgba(0,0,0,.1); border-color:#1D4ED8; border-width:2px; }

/* Card image */
.tg-img-wrap { position:relative; width:100%; padding-top:100%; overflow:hidden; background:#F9FAFB; }
.tg-img-wrap .tg-img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; transition:transform .3s ease; }
.tg-card:hover .tg-img { transform:scale(1.05); }
.tg-img-placeholder { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; color:#9CA3AF; font-size:12px; background:#F3F4F6; }

/* Card body */
.tg-card-body { padding:10px 12px 14px; }
.tg-card-name { font-size:14px; font-weight:600; color:#111827; margin-bottom:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Badge */
.tg-badge { position:absolute; top:8px; left:8px; z-index:2; background:#1D4ED8; color:#fff; font-size:10px; font-weight:700; padding:3px 8px; border-radius:4px; letter-spacing:.05em; text-transform:uppercase; }

/* Hidden during filter */
.tg-card.tg-hidden { display:none; }

/* ---------------------------------------------------------------
   DETAIL WIDGET — .td-wrapper
--------------------------------------------------------------- */

/* --- Banner --- */
.td-banner { position:relative; width:100%; height:480px; background-size:cover; background-position:center; background-repeat:no-repeat; overflow:hidden; }
.td-banner-overlay { position:absolute; inset:0; background:rgba(0,0,0,.25); pointer-events:none; }
.td-banner-text { position:absolute; bottom:40px; left:48px; right:48px; z-index:2; }
.td-banner-title { font-size:36px; font-weight:800; color:#fff; margin:0 0 8px; line-height:1.2; text-shadow:0 2px 12px rgba(0,0,0,.45); }
.td-banner-sub   { font-size:17px; color:rgba(255,255,255,.88); margin:0; text-shadow:0 1px 6px rgba(0,0,0,.3); }

/* --- Content container --- */
.td-content { background:#fff; border-radius:0 0 16px 16px; padding:36px 48px 48px; }

/* --- Tile info --- */
.td-info { margin-bottom:32px; }
.td-tile-name { font-size:28px; font-weight:700; color:#111827; margin:0 0 12px; line-height:1.2; }
.td-tile-desc  { font-size:15px; color:#4B5563; line-height:1.8; margin:0; }
.td-tile-desc p { margin:0 0 8px; }

/* --- Sizes --- */
.td-sizes-wrap  { margin-bottom:36px; padding:24px; background:#F9FAFB; border-radius:12px; border:1px solid #E5E7EB; }
.td-sizes-label { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.12em; color:#9CA3AF; margin-bottom:18px; }
.td-sizes-row   { display:flex; flex-wrap:wrap; align-items:flex-end; gap:24px; }
.td-size-item   { display:flex; flex-direction:column; align-items:center; gap:8px; cursor:pointer; transition:transform .15s ease; }
.td-size-item:hover { transform:translateY(-2px); }
.td-size-frame-wrap { display:flex; align-items:flex-end; justify-content:center; }
.td-size-frame  { position:relative; border:1.5px solid #D1D5DB; border-radius:3px; background:#fff; overflow:hidden; transition:border-color .18s, background .18s; }
.td-size-texture { position:absolute; inset:0; background-image:linear-gradient(to right,rgba(0,0,0,.05) 1px,transparent 1px),linear-gradient(to bottom,rgba(0,0,0,.05) 1px,transparent 1px); background-size:33.33% 33.33%; }
.td-size-frame::after { content:''; position:absolute; inset:3px; border:.5px dashed rgba(0,0,0,.1); border-radius:1px; }
.td-size-item.td-size-active .td-size-frame,
.td-size-item:hover .td-size-frame { border-color:#1D4ED8; background:#EFF6FF; }
.td-size-info   { display:flex; flex-direction:column; align-items:center; gap:1px; text-align:center; }
.td-size-dim    { font-size:11px; font-weight:600; color:#374151; line-height:1; transition:color .15s; }
.td-size-unit   { font-size:10px; color:#9CA3AF; line-height:1; }
.td-size-item.td-size-active .td-size-dim { color:#1D4ED8; }
.td-size-item.td-size-active .td-size-dim::before { content:''; display:inline-block; width:5px; height:5px; border-radius:50%; background:#1D4ED8; margin-right:4px; vertical-align:middle; margin-top:-2px; }

/* --- Finishes section --- */
.td-finishes    { border:1px solid #E5E7EB; border-radius:12px; overflow:hidden; }

/* Tabs */
.td-tabs        { display:flex; border-bottom:1px solid #E5E7EB; background:#F9FAFB; }
.td-tab-btn     { flex:0 0 auto; padding:14px 28px; background:transparent; border:none; border-bottom:3px solid transparent; cursor:pointer; font-size:13px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; transition:color .18s, border-color .18s, background .18s; font-family:inherit; margin-bottom:-1px; }
.td-tab-btn:hover { background:#fff; }
.td-tab-btn.td-active { background:#fff; border-bottom-color:#1D4ED8; color:#1D4ED8; }

/* Single finish label (no tabs) */
.td-single-finish-label { margin:16px 20px 0; }

/* Tab panels */
.td-tab-panel           { display:none; padding:28px; }
.td-tab-panel.td-active { display:block; animation:tdFadeIn .2s ease; }
@keyframes tdFadeIn { from{opacity:0;transform:translateY(4px);}to{opacity:1;transform:translateY(0);} }

.td-finish-desc { font-size:14px; color:#4B5563; margin:0 0 20px; line-height:1.7; }

/* Finish gallery */
.td-finish-gallery { display:flex; flex-direction:column; gap:12px; }
.td-main-img-wrap  { width:100%; border-radius:10px; overflow:hidden; background:#F3F4F6; }
.td-main-img       { width:100%; height:420px; object-fit:cover; display:block; transition:opacity .2s ease; border-radius:10px; }
.td-thumbs         { display:flex; flex-wrap:wrap; gap:8px; }
.td-thumb          { width:72px; height:72px; object-fit:cover; border-radius:7px; cursor:pointer; border:2px solid transparent; transition:border-color .15s, transform .15s; background:#F3F4F6; }
.td-thumb:hover    { border-color:#9CA3AF; transform:translateY(-1px); }
.td-thumb.td-thumb-active { border-color:#1D4ED8; }

.td-no-images      { font-size:14px; color:#9CA3AF; padding:24px 0; }

/* ---------------------------------------------------------------
   RESPONSIVE
--------------------------------------------------------------- */
@media(max-width:1024px){
    .tg-grid { grid-template-columns:repeat(3,1fr); }
    .td-content { padding:28px 32px 36px; }
    .td-banner-text { left:32px; right:32px; bottom:30px; }
    .td-banner-title { font-size:28px; }
}
@media(max-width:768px){
    .tg-grid { grid-template-columns:repeat(2,1fr); gap:12px; }
    .td-banner { height:280px !important; }
    .td-banner-text { left:20px; right:20px; bottom:20px; }
    .td-banner-title { font-size:22px; }
    .td-banner-sub   { font-size:14px; }
    .td-content { padding:20px 18px 28px; }
    .td-main-img { height:260px; }
    .td-tab-btn { padding:12px 18px; font-size:12px; }
    .td-tile-name { font-size:22px; }
}
@media(max-width:480px){
    .tg-grid { grid-template-columns:repeat(2,1fr); gap:8px; }
    .tg-header-title { font-size:22px; }
    .td-banner { height:220px !important; }
    .td-content { padding:16px 14px 24px; }
    .td-main-img { height:200px; }
    .td-sizes-wrap { padding:16px; }
    .td-sizes-row { gap:16px; }
    .td-size-dim { font-size:10px; }
    .td-tab-btn { padding:10px 14px; }
    .td-tab-panel { padding:16px; }
    .td-thumb { width:56px; height:56px; }
    .td-tile-name { font-size:19px; }
}
