/* SavvyGreat Material 3 federated World Video Search */
.sgvi-m3-query-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(164px, 1fr));
    gap: 10px;
    align-self: stretch;
}

.sgvi-m3-query-actions .sgvi-m3-search-button,
.sgws-m3-search-button {
    min-width: 164px;
    min-height: 72px;
}

.sgws-m3-search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    border: 1px solid var(--sgvi-outline-variant);
    border-radius: 24px;
    background: var(--sgvi-secondary-container);
    color: var(--sgvi-on-secondary-container);
    font-size: 14px;
    font-weight: 760;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.sgws-m3-search-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .13);
}

.sgws-m3-search-button[aria-pressed="true"] {
    border-color: var(--sgvi-primary);
    background: var(--sgvi-primary-container);
    color: var(--sgvi-on-primary-container);
}

.sgws-m3-search-button:disabled {
    cursor: wait;
    opacity: .72;
}

.sgws-m3-results-section {
    margin-top: clamp(28px, 4vw, 52px);
}

.sgws-m3-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 16px;
}

.sgws-m3-toolbar h2 {
    margin: 7px 0 0;
    font-family: var(--m3-font-brand, "Google Sans", "Segoe UI", sans-serif);
    font-size: clamp(28px, 3vw, 42px);
    font-weight: 650;
    letter-spacing: -.035em;
    line-height: 1.06;
}

.sgws-m3-toolbar p {
    margin: 7px 0 0;
    color: var(--sgvi-on-surface-variant);
    font-size: 13px;
    line-height: 1.5;
}

.sgws-m3-service-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 13px;
    border: 1px solid var(--sgvi-outline-variant);
    border-radius: 22px;
    background: var(--sgvi-surface-container);
    color: var(--sgvi-on-surface-variant);
    font-size: 12px;
    font-weight: 720;
    white-space: nowrap;
}

.sgws-m3-service-status .material-symbols-rounded {
    font-size: 20px;
    animation: sgws-spin 1s linear infinite;
}

.sgws-m3-service-status[data-ready="true"] {
    border-color: color-mix(in srgb, #146c2e 35%, var(--sgvi-outline-variant));
    background: color-mix(in srgb, #c4eed0 38%, var(--sgvi-surface));
    color: #0d4a22;
}

.sgws-m3-service-status[data-ready="true"] .material-symbols-rounded,
.sgws-m3-service-status[data-ready="false"] .material-symbols-rounded {
    animation: none;
}

@keyframes sgws-spin {
    to { transform: rotate(360deg); }
}

.sgws-m3-provider-strip,
.sgws-m3-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
}

.sgws-m3-provider-strip > span,
.sgws-m3-suggestions button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid var(--sgvi-outline-variant);
    border-radius: 19px;
    background: var(--sgvi-surface-low);
    color: var(--sgvi-on-surface-variant);
    font-size: 12px;
    font-weight: 700;
}

.sgws-m3-provider-strip > span.is-available {
    border-color: color-mix(in srgb, #146c2e 32%, var(--sgvi-outline-variant));
    background: color-mix(in srgb, #c4eed0 25%, var(--sgvi-surface));
}

.sgws-m3-provider-strip > span.is-unavailable {
    opacity: .7;
}

.sgws-m3-provider-strip .material-symbols-rounded {
    font-size: 18px;
}

.sgws-m3-suggestions button {
    cursor: pointer;
}

.sgws-m3-suggestions button:hover {
    border-color: var(--sgvi-primary);
    background: var(--sgvi-primary-container);
    color: var(--sgvi-on-primary-container);
}

.sgws-m3-state {
    display: grid;
    justify-items: center;
    gap: 10px;
    min-height: 210px;
    padding: 34px;
    place-content: center;
    border: 1px dashed var(--sgvi-outline-variant);
    border-radius: 30px;
    background: var(--sgvi-surface-low);
    text-align: center;
}

.sgws-m3-state > .material-symbols-rounded {
    color: var(--sgvi-primary);
    font-size: 44px;
}

.sgws-m3-state[data-sgws-loading] > .material-symbols-rounded {
    animation: sgws-spin 1s linear infinite;
}

.sgws-m3-state h3 {
    margin: 0;
    font-size: 23px;
}

.sgws-m3-state p {
    max-width: 62ch;
    margin: 0;
    color: var(--sgvi-on-surface-variant);
    line-height: 1.55;
}

.sgws-m3-state button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    margin-top: 4px;
    padding: 0 20px;
    border: 0;
    border-radius: 24px;
    background: var(--sgvi-secondary-container);
    color: var(--sgvi-on-secondary-container);
    font-size: 14px;
    font-weight: 760;
    cursor: pointer;
}

.sgws-m3-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(14px, 2vw, 24px);
}

.sgws-m3-video-card {
    display: grid;
    grid-template-rows: auto 1fr;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--sgvi-outline-variant);
    border-radius: 28px;
    background: var(--sgvi-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.sgws-m3-video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .13);
}

.sgws-m3-video-media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #17131c;
}

.sgws-m3-video-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 240ms ease;
}

.sgws-m3-video-card:hover .sgws-m3-video-media img {
    transform: scale(1.025);
}

.sgws-m3-video-source,
.sgws-m3-video-duration {
    position: absolute;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 9px;
    border-radius: 14px;
    background: rgba(20, 17, 24, .83);
    color: #fff;
    font-size: 11px;
    font-weight: 760;
    backdrop-filter: blur(8px);
}

.sgws-m3-video-source {
    top: 10px;
    left: 10px;
}

.sgws-m3-video-duration {
    right: 10px;
    bottom: 10px;
}

.sgws-m3-video-play {
    position: absolute;
    inset: 50% auto auto 50%;
    display: grid;
    width: 58px;
    height: 58px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--sgvi-primary) 90%, #000);
    color: var(--sgvi-on-primary);
    box-shadow: 0 5px 18px rgba(0, 0, 0, .3);
    cursor: pointer;
    transform: translate(-50%, -50%);
}

.sgws-m3-video-play .material-symbols-rounded {
    font-size: 32px;
    font-variation-settings: "FILL" 1, "wght" 650, "GRAD" 0, "opsz" 32;
}

.sgws-m3-video-play:disabled {
    background: rgba(73, 69, 79, .72);
    cursor: not-allowed;
    opacity: .75;
}

.sgws-m3-video-body {
    display: grid;
    grid-template-rows: auto auto auto 1fr;
    gap: 10px;
    min-width: 0;
    padding: 18px;
}

.sgws-m3-video-body h3 {
    display: -webkit-box;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: var(--sgvi-on-surface);
    font-family: var(--m3-font-brand, "Google Sans", "Segoe UI", sans-serif);
    font-size: clamp(18px, 1.55vw, 22px);
    font-weight: 650;
    letter-spacing: -.018em;
    line-height: 1.24;
    text-wrap: balance;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.sgws-m3-video-body > p {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--sgvi-on-surface-variant);
    font-size: 13px;
    line-height: 1.56;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.sgws-m3-video-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    color: var(--sgvi-on-surface-variant);
    font-size: 11px;
    font-weight: 650;
}

.sgws-m3-video-meta span + span::before {
    content: "•";
    margin-right: 12px;
    color: var(--sgvi-outline);
}

.sgws-m3-preview-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: end;
    gap: 8px;
    min-height: 48px;
    margin-top: 2px;
    padding: 0 18px;
    border: 0;
    border-radius: 24px;
    background: var(--sgvi-primary-container);
    color: var(--sgvi-on-primary-container);
    font-size: 13px;
    font-weight: 760;
    cursor: pointer;
}

.sgws-m3-preview-button:hover:not(:disabled) {
    box-shadow: 0 3px 9px rgba(0, 0, 0, .11);
}

.sgws-m3-preview-button:disabled {
    background: var(--sgvi-surface-container);
    color: var(--sgvi-on-surface-variant);
    cursor: not-allowed;
    opacity: .72;
}

.sgws-m3-load-more {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 9px;
    margin-top: 26px;
}

.sgws-m3-lazy-sentinel {
    position: absolute;
    top: -1px;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.sgws-m3-load-more button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 20px;
    border: 0;
    border-radius: 24px;
    background: var(--sgvi-secondary-container);
    color: var(--sgvi-on-secondary-container);
    font-size: 14px;
    font-weight: 760;
    cursor: pointer;
}

.sgws-m3-load-more > span:last-child {
    color: var(--sgvi-on-surface-variant);
    font-size: 12px;
}

.sgws-m3-dialog {
    width: min(960px, calc(100vw - 28px));
    max-width: 960px;
    max-height: calc(100vh - 28px);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--sgvi-outline-variant);
    border-radius: 32px;
    background: var(--sgvi-surface);
    color: var(--sgvi-on-surface);
    box-shadow: 0 18px 52px rgba(0, 0, 0, .28);
}

.sgws-m3-dialog::backdrop {
    background: rgba(20, 17, 24, .68);
    backdrop-filter: blur(5px);
}

.sgws-m3-dialog header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 14px;
    align-items: start;
    padding: 18px 18px 14px 22px;
}

.sgws-m3-dialog header h2 {
    margin: 6px 0 0;
    font-family: var(--m3-font-brand, "Google Sans", "Segoe UI", sans-serif);
    font-size: clamp(21px, 2.7vw, 31px);
    line-height: 1.12;
}

.sgws-m3-dialog header p {
    margin: 7px 0 0;
    color: var(--sgvi-on-surface-variant);
    font-size: 12px;
}

.sgws-m3-dialog header button {
    display: grid;
    width: 48px;
    height: 48px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--sgvi-on-surface-variant);
    cursor: pointer;
}

.sgws-m3-dialog header button:hover {
    background: var(--sgvi-surface-container);
}

.sgws-m3-player {
    aspect-ratio: 16 / 9;
    background: #000;
}

.sgws-m3-player iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.sgws-m3-dialog footer {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 58px;
    padding: 10px 20px;
    background: var(--sgvi-surface-low);
    color: var(--sgvi-on-surface-variant);
    font-size: 12px;
    line-height: 1.4;
}

.sgws-m3-dialog footer .material-symbols-rounded {
    color: var(--sgvi-primary);
    font-size: 21px;
}

@media (max-width: 1099px) {
    .sgvi-m3-query-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .sgvi-m3-query-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sgvi-m3-query-actions .sgvi-m3-search-button,
    .sgws-m3-search-button {
        min-width: 0;
        min-height: 58px;
    }

    .sgws-m3-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 699px) {
    .sgvi-m3-query-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .sgws-m3-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .sgws-m3-service-status {
        align-self: flex-start;
        white-space: normal;
    }

    .sgws-m3-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .sgws-m3-video-card {
        border-radius: 24px;
    }

    .sgws-m3-dialog {
        width: 100vw;
        max-width: 100vw;
        max-height: 92vh;
        margin: auto 0 0;
        border-width: 1px 0 0;
        border-radius: 28px 28px 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sgws-m3-search-button,
    .sgws-m3-video-card,
    .sgws-m3-video-media img {
        transition: none;
    }

    .sgws-m3-service-status .material-symbols-rounded,
    .sgws-m3-state[data-sgws-loading] > .material-symbols-rounded {
        animation: none;
    }
}

@media (forced-colors: active) {
    .sgws-m3-search-button,
    .sgws-m3-video-card,
    .sgws-m3-provider-strip > span,
    .sgws-m3-suggestions button,
    .sgws-m3-preview-button,
    .sgws-m3-dialog {
        border: 1px solid CanvasText;
    }
}
