/* =====================================================================
 * Tiger Advanced Loop — base styles
 *
 * The widget exposes most visual properties as Elementor controls, so this
 * file only carries the structural rules and the small set of defaults
 * needed for the toggle bar, the grid/list wrappers, the pagination, and
 * the load-more button to render without per-instance tweaks.
 * ===================================================================== */

.tg-lw-grid { display: grid;  width: 100%; transition: opacity 0.3s ease; }
.tg-lw-list { display: flex;  flex-direction: column; width: 100%; transition: opacity 0.3s ease; }

/* The list wrapper is hidden until the toggle JS swaps it in. */
.tg-lw-list:not(.is-active) { display: none; }
.tg-lw-list.is-active       { display: flex; }
.tg-lw-grid.is-hidden       { display: none; }

.tg-lw-grid.is-fading,
.tg-lw-list.is-fading { opacity: 0; }

.tg-lw-toggle-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.tg-lw-toggle-btn {
    background: #f1f5f9;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    transition: background-color 0.2s ease, color 0.2s ease;
    outline: none;
}
.tg-lw-toggle-btn:hover  { background: #e2e8f0; color: #334155; }
.tg-lw-toggle-btn.active { background: #ec7002; color: #ffffff; }

.tg-lw-pag {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
}
.tg-lw-pag a,
.tg-lw-pag span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-weight: 500;
    padding: 0 12px;
}
.tg-lw-pag a:hover         { background: #e2e8f0; color: #1e293b; }
.tg-lw-pag span.current    { background: #ec7002; color: #fff; }

.tg-lw-more-wrap {
    text-align: center;
    margin-top: 30px;
}
.tg-lw-more-btn {
    background: #ec7002;
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}
.tg-lw-more-btn:hover         { background: #4f46e5; }
.tg-lw-more-btn.is-loading    { opacity: 0.7; pointer-events: none; }

/* While an AJAX filter / pagination request is in flight, dim the current grid
   AND show a centered spinner so the click gives immediate, unambiguous
   feedback even before the (uncached, ~1s) response returns. Cache hits skip
   the .is-loading class entirely, so the spinner never flashes on instant swaps. */
.tg-lw-ajax-wrap { position: relative; }
.tg-lw-ajax-wrap.is-loading .tg-lw-grid { opacity: .35; pointer-events: none; transition: opacity .15s ease; }
.tg-lw-ajax-wrap.is-loading::after {
    content: "";
    position: absolute;
    top: 60px;
    left: 50%;
    width: 44px;
    height: 44px;
    margin-left: -22px;
    border: 4px solid rgba(17, 24, 39, 0.15);
    border-top-color: #111;
    border-radius: 50%;
    animation: tg-lw-spin 0.7s linear infinite;
    z-index: 6;
    pointer-events: none;
}
@keyframes tg-lw-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .tg-lw-ajax-wrap.is-loading::after { animation-duration: 1.6s; }
}

/* Editor-side notices when a template is missing or a query returns empty. */
.tg-lw-notice {
    padding: 20px;
    border-radius: 5px;
    text-align: center;
}
.tg-lw-notice.tg-lw-error { background: #f8d7da; color: #721c24; }
.tg-lw-notice.tg-lw-empty { background: transparent; color: #64748b; padding: 40px; }
