/**
 * Touch — Channel Layouts
 * 10 structural layouts for how channels appear inside the panel.
 *
 * Each layout class is applied to .tch-widget-panel:
 *   .tch-layout-{slug}
 *
 * Base channel HTML (from renderer):
 *   .tch-channel > .tch-channel-link > .tch-channel-icon + .tch-channel-content + .tch-channel-arrow
 *
 * @package Touch
 * @since   1.2.0
 */

/* ============================================================
   Shared entry animation keyframes
   ============================================================ */

@keyframes tch-l-fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0);    }
}

@keyframes tch-l-pop-in {
    0%   { opacity: 0; transform: scale(0.7);  }
    70%  { transform: scale(1.06); }
    100% { opacity: 1; transform: scale(1);    }
}

@keyframes tch-l-slide-right {
    from { opacity: 0; transform: translateX(-18px); }
    to   { opacity: 1; transform: translateX(0);     }
}

@keyframes tch-l-slide-left {
    from { opacity: 0; transform: translateX(18px); }
    to   { opacity: 1; transform: translateX(0);    }
}

@keyframes tch-l-flip-in {
    from { opacity: 0; transform: rotateX(-60deg) translateY(-8px); }
    to   { opacity: 1; transform: rotateX(0deg)   translateY(0);    }
}

/* ============================================================
   LAYOUT 1 — List (default)
   Icon left · title + description · arrow right
   ============================================================ */

.tch-layout-list .tch-channels-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tch-layout-list .tch-channel {
    animation: tch-l-fade-up 280ms ease both;
}

.tch-layout-list .tch-channel:nth-child(1) { animation-delay: 40ms;  }
.tch-layout-list .tch-channel:nth-child(2) { animation-delay: 90ms;  }
.tch-layout-list .tch-channel:nth-child(3) { animation-delay: 140ms; }
.tch-layout-list .tch-channel:nth-child(4) { animation-delay: 190ms; }
.tch-layout-list .tch-channel:nth-child(5) { animation-delay: 240ms; }
.tch-layout-list .tch-channel:nth-child(n+6) { animation-delay: 290ms; }

.tch-layout-list .tch-channel-link {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tch-layout-list .tch-channel-icon { flex-shrink: 0; }
.tch-layout-list .tch-channel-content { flex: 1; min-width: 0; }
.tch-layout-list .tch-channel-description { display: block; }
.tch-layout-list .tch-channel-arrow { display: flex; }

/* ============================================================
   LAYOUT 2 — Compact
   Icon left · Title only, no description, no arrow
   ============================================================ */

.tch-layout-compact .tch-channels-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tch-layout-compact .tch-channel {
    animation: tch-l-slide-right 240ms ease both;
}

.tch-layout-compact .tch-channel:nth-child(1) { animation-delay: 30ms;  }
.tch-layout-compact .tch-channel:nth-child(2) { animation-delay: 70ms;  }
.tch-layout-compact .tch-channel:nth-child(3) { animation-delay: 110ms; }
.tch-layout-compact .tch-channel:nth-child(4) { animation-delay: 150ms; }
.tch-layout-compact .tch-channel:nth-child(n+5) { animation-delay: 190ms; }

.tch-layout-compact .tch-channel { padding: 10px 12px; }

.tch-layout-compact .tch-channel-link {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tch-layout-compact .tch-channel-icon {
    width: var(--tch-channel-icon-size, 34px);
    height: var(--tch-channel-icon-size, 34px);
    flex-shrink: 0;
}

.tch-layout-compact .tch-channel-content { flex: 1; }
.tch-layout-compact .tch-channel-description { display: none; }
.tch-layout-compact .tch-channel-arrow { display: none; }

.tch-layout-compact .tch-channel-title {
    font-size: var(--tch-channel-title-size, 13px);
    font-weight: 600;
    margin: 0;
}

/* ============================================================
   LAYOUT 3 — Icon Only
   Large icons in a horizontal wrapping row
   Title appears as tooltip via aria-label / title attribute (CSS)
   ============================================================ */

.tch-layout-icon-only .tch-channels-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.tch-layout-icon-only .tch-channel {
    flex: 0 0 auto;
    padding: 0;
    background: transparent !important;
    border-radius: 50%;
    animation: tch-l-pop-in 320ms cubic-bezier(0.34,1.56,0.64,1) both;
}

.tch-layout-icon-only .tch-channel:nth-child(1) { animation-delay: 0ms;  }
.tch-layout-icon-only .tch-channel:nth-child(2) { animation-delay: 60ms; }
.tch-layout-icon-only .tch-channel:nth-child(3) { animation-delay:120ms; }
.tch-layout-icon-only .tch-channel:nth-child(4) { animation-delay:180ms; }
.tch-layout-icon-only .tch-channel:nth-child(n+5){ animation-delay:240ms;}

.tch-layout-icon-only .tch-channel-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--tch-channel-icon-size, 52px);
    height: var(--tch-channel-icon-size, 52px);
    border-radius: 50%;
    position: relative;
}

.tch-layout-icon-only .tch-channel-icon {
    width: var(--tch-channel-icon-size, 52px);
    height: var(--tch-channel-icon-size, 52px);
    border-radius: 50%;
    margin: 0;
    transition: transform 200ms ease, box-shadow 200ms ease;
}

.tch-layout-icon-only .tch-channel-link:hover .tch-channel-icon {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* Hide text */
.tch-layout-icon-only .tch-channel-content,
.tch-layout-icon-only .tch-channel-arrow { display: none; }

/* Tooltip from aria-label via CSS */
.tch-layout-icon-only .tch-channel-link::after {
    content: attr(aria-label);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: rgba(15,23,42,0.9);
    color: #fff;
    font-size: var(--tch-channel-desc-size, 11px);
    font-weight: 600;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 180ms ease, transform 180ms ease;
}

.tch-layout-icon-only .tch-channel-link:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* ============================================================
   LAYOUT 4 — Icon + Label (vertical grid)
   Icon above, title below — 3-column grid
   ============================================================ */

.tch-layout-icon-label .tch-channels-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.tch-layout-icon-label .tch-channel {
    padding: 0;
    background: transparent !important;
    animation: tch-l-pop-in 300ms cubic-bezier(0.34,1.56,0.64,1) both;
}

.tch-layout-icon-label .tch-channel:nth-child(1) { animation-delay: 0ms;  }
.tch-layout-icon-label .tch-channel:nth-child(2) { animation-delay: 50ms; }
.tch-layout-icon-label .tch-channel:nth-child(3) { animation-delay:100ms; }
.tch-layout-icon-label .tch-channel:nth-child(4) { animation-delay:150ms; }
.tch-layout-icon-label .tch-channel:nth-child(n+5){ animation-delay:200ms;}

.tch-layout-icon-label .tch-channel-link {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 12px 6px;
    border-radius: 12px;
    transition: background 200ms, transform 200ms;
}

.tch-layout-icon-label .tch-channel-link:hover {
    background: rgba(0,0,0,0.05);
    transform: translateY(-3px);
}

.tch-layout-icon-label .tch-channel-icon {
    width: var(--tch-channel-icon-size, 44px);
    height: var(--tch-channel-icon-size, 44px);
    border-radius: 12px;
    margin: 0;
}

.tch-layout-icon-label .tch-channel-content { flex: unset; }

.tch-layout-icon-label .tch-channel-title {
    font-size: var(--tch-channel-title-size, 11px);
    font-weight: 600;
    line-height: 1.3;
}

.tch-layout-icon-label .tch-channel-description,
.tch-layout-icon-label .tch-channel-arrow { display: none; }

/* ============================================================
   LAYOUT 5 — Banner
   Full-width rows with left colour accent strip
   ============================================================ */

.tch-layout-banner .tch-channels-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tch-layout-banner .tch-channel {
    padding: 0;
    border-radius: 0;
    background: transparent !important;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    animation: tch-l-slide-right 260ms ease both;
    overflow: hidden;
}

.tch-layout-banner .tch-channel:first-child { border-radius: 8px 8px 0 0; }
.tch-layout-banner .tch-channel:last-child  { border-radius: 0 0 8px 8px; border-bottom: none; }

.tch-layout-banner .tch-channel:nth-child(1) { animation-delay: 0ms;  }
.tch-layout-banner .tch-channel:nth-child(2) { animation-delay: 60ms; }
.tch-layout-banner .tch-channel:nth-child(3) { animation-delay:120ms; }
.tch-layout-banner .tch-channel:nth-child(4) { animation-delay:180ms; }
.tch-layout-banner .tch-channel:nth-child(n+5){ animation-delay:240ms;}

.tch-layout-banner .tch-channel-link {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 14px 14px 14px 0;
    position: relative;
}

/* Left colour strip */
.tch-layout-banner .tch-channel-icon {
    width: var(--tch-channel-icon-size, 50px);
    height: var(--tch-channel-icon-size, 50px);
    border-radius: 0;
    margin-right: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--channel-color, var(--tch-primary-color));
}

.tch-layout-banner .tch-channel-link:hover .tch-channel-icon {
    filter: brightness(1.1);
}

.tch-layout-banner .tch-channel-content { flex: 1; }

.tch-layout-banner .tch-channel-title {
    font-size: var(--tch-channel-title-size, 14px);
    font-weight: 700;
    margin-bottom: 2px;
}

.tch-layout-banner .tch-channel-description {
    font-size: var(--tch-channel-desc-size, 11px);
    opacity: 0.7;
}

.tch-layout-banner .tch-channel-arrow {
    margin-right: 4px;
    opacity: 0.4;
}

.tch-layout-banner .tch-channel-link:hover {
    background: rgba(0,0,0,0.03);
    transform: none;
}

/* ============================================================
   LAYOUT 6 — Pill Buttons
   Rounded full-width pills, icon left, title centred
   ============================================================ */

.tch-layout-pill .tch-channels-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tch-layout-pill .tch-channel {
    padding: 0;
    background: transparent !important;
    border-radius: 999px;
    animation: tch-l-pop-in 260ms cubic-bezier(0.34,1.56,0.64,1) both;
}

.tch-layout-pill .tch-channel:nth-child(1) { animation-delay: 30ms;  }
.tch-layout-pill .tch-channel:nth-child(2) { animation-delay: 80ms;  }
.tch-layout-pill .tch-channel:nth-child(3) { animation-delay: 130ms; }
.tch-layout-pill .tch-channel:nth-child(4) { animation-delay: 180ms; }
.tch-layout-pill .tch-channel:nth-child(n+5){ animation-delay: 230ms;}

.tch-layout-pill .tch-channel-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 10px 10px;
    border-radius: 999px;
    border: 2px solid rgba(0,0,0,0.08);
    transition: border-color 200ms, background 200ms, transform 200ms, box-shadow 200ms;
}

.tch-layout-pill .tch-channel-link:hover {
    border-color: var(--channel-color, var(--tch-primary-color));
    background: rgba(0,0,0,0.03);
    transform: scale(1.03);
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}

.tch-layout-pill .tch-channel-icon {
    width: var(--tch-channel-icon-size, 36px);
    height: var(--tch-channel-icon-size, 36px);
    border-radius: 50%;
    margin: 0;
    flex-shrink: 0;
}

.tch-layout-pill .tch-channel-content { flex: 1; text-align: center; }

.tch-layout-pill .tch-channel-title {
    font-size: var(--tch-channel-title-size, 13px);
    font-weight: 700;
}

.tch-layout-pill .tch-channel-description { display: none; }
.tch-layout-pill .tch-channel-arrow { display: none; }

/* ============================================================
   LAYOUT 7 — Card Grid
   2-column grid of small cards
   ============================================================ */

.tch-layout-card-grid .tch-channels-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tch-layout-card-grid .tch-channel {
    padding: 0;
    background: transparent !important;
    animation: tch-l-flip-in 300ms ease both;
    perspective: 600px;
}

.tch-layout-card-grid .tch-channel:nth-child(1) { animation-delay: 0ms;  }
.tch-layout-card-grid .tch-channel:nth-child(2) { animation-delay: 60ms; }
.tch-layout-card-grid .tch-channel:nth-child(3) { animation-delay:120ms; }
.tch-layout-card-grid .tch-channel:nth-child(4) { animation-delay:180ms; }
.tch-layout-card-grid .tch-channel:nth-child(n+5){ animation-delay:240ms;}

.tch-layout-card-grid .tch-channel-link {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px 10px;
    border-radius: 14px;
    background: rgba(0,0,0,0.04);
    border: 1.5px solid rgba(0,0,0,0.07);
    gap: 8px;
    transition: transform 200ms ease, box-shadow 200ms ease, background 200ms;
}

.tch-layout-card-grid .tch-channel-link:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.8);
}

.tch-layout-card-grid .tch-channel-icon {
    width: var(--tch-channel-icon-size, 42px);
    height: var(--tch-channel-icon-size, 42px);
    border-radius: 12px;
    margin: 0;
}

.tch-layout-card-grid .tch-channel-title {
    font-size: var(--tch-channel-title-size, 12px);
    font-weight: 700;
    line-height: 1.2;
}

.tch-layout-card-grid .tch-channel-description,
.tch-layout-card-grid .tch-channel-arrow { display: none; }

/* ============================================================
   LAYOUT 8 — Spotlight
   Large icon, big title, description — centred vertical stack
   ============================================================ */

.tch-layout-spotlight .tch-channels-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tch-layout-spotlight .tch-channel {
    padding: 0;
    background: transparent !important;
    animation: tch-l-pop-in 340ms cubic-bezier(0.34,1.56,0.64,1) both;
}

.tch-layout-spotlight .tch-channel:nth-child(1) { animation-delay: 0ms;   }
.tch-layout-spotlight .tch-channel:nth-child(2) { animation-delay: 80ms;  }
.tch-layout-spotlight .tch-channel:nth-child(3) { animation-delay: 160ms; }
.tch-layout-spotlight .tch-channel:nth-child(n+4){ animation-delay: 220ms;}

.tch-layout-spotlight .tch-channel-link {
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 14px 12px;
    border-radius: 16px;
    background: rgba(0,0,0,0.035);
    border: 1.5px solid transparent;
    transition: background 220ms, border-color 220ms, transform 220ms, box-shadow 220ms;
}

.tch-layout-spotlight .tch-channel-link:hover {
    background: rgba(255,255,255,0.75);
    border-color: rgba(0,0,0,0.1);
    transform: scale(1.025);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.tch-layout-spotlight .tch-channel-icon {
    width: var(--tch-channel-icon-size, 52px);
    height: var(--tch-channel-icon-size, 52px);
    border-radius: 16px;
    flex-shrink: 0;
    margin: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.tch-layout-spotlight .tch-channel-content { flex: 1; }

.tch-layout-spotlight .tch-channel-title {
    font-size: var(--tch-channel-title-size, 15px);
    font-weight: 700;
    margin-bottom: 3px;
}

.tch-layout-spotlight .tch-channel-description {
    font-size: var(--tch-channel-desc-size, 12px);
    display: block;
    line-height: 1.4;
}

.tch-layout-spotlight .tch-channel-arrow { display: flex; opacity: 0.35; }

/* ============================================================
   LAYOUT 9 — Side Strip
   Bold coloured left border, icon + title horizontal
   ============================================================ */

.tch-layout-side-strip .tch-channels-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tch-layout-side-strip .tch-channel {
    padding: 0;
    background: transparent !important;
    border-radius: 10px;
    overflow: hidden;
    animation: tch-l-slide-right 250ms ease both;
}

.tch-layout-side-strip .tch-channel:nth-child(1) { animation-delay: 0ms;  }
.tch-layout-side-strip .tch-channel:nth-child(2) { animation-delay: 55ms; }
.tch-layout-side-strip .tch-channel:nth-child(3) { animation-delay:110ms; }
.tch-layout-side-strip .tch-channel:nth-child(4) { animation-delay:165ms; }
.tch-layout-side-strip .tch-channel:nth-child(n+5){ animation-delay:220ms;}

.tch-layout-side-strip .tch-channel-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(0,0,0,0.035);
    border-left: 4px solid var(--channel-color, var(--tch-primary-color));
    transition: background 200ms, transform 200ms, box-shadow 200ms;
}

/* RTL: swap border side */
.tch-widget.tch-rtl .tch-layout-side-strip .tch-channel-link {
    border-left: none;
    border-right: 4px solid var(--channel-color, var(--tch-primary-color));
}

.tch-layout-side-strip .tch-channel-link:hover {
    background: rgba(255,255,255,0.7);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.tch-widget.tch-rtl .tch-layout-side-strip .tch-channel-link:hover {
    transform: translateX(-4px);
}

.tch-layout-side-strip .tch-channel-icon {
    width: var(--tch-channel-icon-size, 38px);
    height: var(--tch-channel-icon-size, 38px);
    border-radius: 8px;
    flex-shrink: 0;
    margin: 0;
}

.tch-layout-side-strip .tch-channel-content { flex: 1; }
.tch-layout-side-strip .tch-channel-description { font-size: var(--tch-channel-desc-size, 11px); display: block; }
.tch-layout-side-strip .tch-channel-arrow { display: none; }

/* ============================================================
   LAYOUT 10 — Chips
   Small rounded chips that wrap horizontally
   ============================================================ */

.tch-layout-chips .tch-channels-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}

.tch-layout-chips .tch-channel {
    flex: 0 0 auto;
    padding: 0;
    background: transparent !important;
    border-radius: 999px;
    animation: tch-l-pop-in 280ms cubic-bezier(0.34,1.56,0.64,1) both;
}

.tch-layout-chips .tch-channel:nth-child(1) { animation-delay: 0ms;  }
.tch-layout-chips .tch-channel:nth-child(2) { animation-delay: 40ms; }
.tch-layout-chips .tch-channel:nth-child(3) { animation-delay: 80ms; }
.tch-layout-chips .tch-channel:nth-child(4) { animation-delay:120ms; }
.tch-layout-chips .tch-channel:nth-child(n+5){ animation-delay:160ms;}

.tch-layout-chips .tch-channel-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px 7px 8px;
    border-radius: 999px;
    border: 1.5px solid rgba(0,0,0,0.1);
    background: rgba(0,0,0,0.04);
    transition: background 180ms, border-color 180ms, transform 180ms, box-shadow 180ms;
    white-space: nowrap;
}

.tch-layout-chips .tch-channel-link:hover {
    background: var(--channel-color, var(--tch-primary-color));
    border-color: var(--channel-color, var(--tch-primary-color));
    color: #fff;
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

.tch-layout-chips .tch-channel-link:hover .tch-channel-icon {
    background: rgba(255,255,255,0.25);
}

.tch-layout-chips .tch-channel-icon {
    width: var(--tch-channel-icon-size, 26px);
    height: var(--tch-channel-icon-size, 26px);
    border-radius: 50%;
    margin: 0;
    flex-shrink: 0;
    transition: background 180ms;
}

.tch-layout-chips .tch-channel-icon img,
.tch-layout-chips .tch-channel-icon svg {
    width: var(--tch-channel-icon-img-size, 14px);
    height: var(--tch-channel-icon-img-size, 14px);
}

.tch-layout-chips .tch-channel-title {
    font-size: var(--tch-channel-title-size, 12px);
    font-weight: 600;
}

.tch-layout-chips .tch-channel-description,
.tch-layout-chips .tch-channel-arrow { display: none; }

/* ============================================================
   Reduced motion — kill all layout animations
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .tch-layout-list .tch-channel,
    .tch-layout-compact .tch-channel,
    .tch-layout-icon-only .tch-channel,
    .tch-layout-icon-label .tch-channel,
    .tch-layout-banner .tch-channel,
    .tch-layout-pill .tch-channel,
    .tch-layout-card-grid .tch-channel,
    .tch-layout-spotlight .tch-channel,
    .tch-layout-side-strip .tch-channel,
    .tch-layout-chips .tch-channel {
        animation: none !important;
        opacity: 1 !important;
    }
}
