/* responsive-tester — page CSS. Lived in an inline <style> in index.php until the
   tool pages moved onto component/tool-layout.cpt.php. Loaded via
   $tool_css, so it lands after editorial.css exactly as the block did. */

.tool-page.responsive-tester {
    max-width: 1400px;
}
.responsive-tester .tool-container {
    max-width: 1400px;
}
.page-content:has(.responsive-tester) {
    max-width: 1500px;
}
.rt-url-bar {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}
.rt-url-field {
    position: relative;
    flex: 1;
    min-width: 0;
}
.rt-url-bar input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-default);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    transition: border-color var(--transition-base);
}
.rt-url-bar input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}
.rt-url-bar input::placeholder {
    color: var(--text-muted);
}
.rt-url-bar button {
    padding: 0.75rem 1.5rem;
    background: var(--accent-cyan);
    color: #000;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity var(--transition-base);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}
.rt-url-bar button:hover { opacity: 0.85; }
.rt-url-bar button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Recently tested URLs, filtered as you type */
.rt-suggest {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 40;
    margin: 0;
    padding: 0.25rem;
    list-style: none;
    /* --bg-raised is not defined by the editorial overlay these pages run under,
       and a popover that resolves to transparent is unreadable. */
    background: var(--ed-card, var(--bg-raised, #2b2a26));
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 260px;
    overflow-y: auto;
}
.rt-suggest[hidden] { display: none; }
.rt-suggest__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: background var(--transition-base), color var(--transition-base);
}
.rt-suggest__item:hover,
.rt-suggest__item.active {
    background: var(--ed-paper, var(--bg-base));
    color: var(--text-default);
}
.rt-suggest__item i { color: var(--text-muted); flex-shrink: 0; }
.rt-suggest__label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rt-suggest__label mark {
    background: none;
    color: var(--accent-cyan);
    font-weight: 600;
}
.rt-suggest__drop {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.15rem 0.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    display: flex;
    opacity: 0;
    transition: opacity var(--transition-base), color var(--transition-base);
}
.rt-suggest__item:hover .rt-suggest__drop,
.rt-suggest__item.active .rt-suggest__drop { opacity: 1; }
.rt-suggest__drop:hover { color: var(--accent-red, #f87171); }

.rt-filters {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}
.rt-filter-chip {
    padding: 0.4rem 0.9rem;
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    user-select: none;
}
.rt-filter-chip:hover {
    border-color: var(--border-hover);
    color: var(--text-default);
}
.rt-filter-chip.active {
    background: var(--accent-cyan);
    color: #000;
    border-color: var(--accent-cyan);
}

.rt-grid {
    position: relative;
    --masonry-columns: 4;
    --masonry-gap: 16px;
}
.rt-grid.masonry-ready .rt-card {
    position: absolute;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.rt-grid.rt-loading .rt-card { pointer-events: none; }

.rt-card {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.rt-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}
.rt-card[hidden] { display: none; }

.rt-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border-subtle);
}
.rt-card__info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.rt-card__icon {
    font-size: 1rem;
    color: var(--accent-cyan);
    flex-shrink: 0;
}
.rt-card__name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-default);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rt-card__res {
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    background: var(--bg-base);
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.rt-card__dpr {
    font-size: 0.65rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-cyan);
    opacity: 0.7;
    flex-shrink: 0;
}
.rt-landscape-btn {
    margin-left: auto;
}
.rt-landscape-btn.active {
    background: var(--accent-cyan);
    color: #000;
    border-color: var(--accent-cyan);
}
.rt-card__expand {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: color var(--transition-base), background var(--transition-base);
    font-size: 1rem;
    display: flex;
    flex-shrink: 0;
}
.rt-card__expand:hover {
    color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.1);
}

.rt-card__viewport {
    position: relative;
    overflow: hidden;
    background: var(--bg-base);
}
.rt-card__viewport iframe {
    display: block;
    border: none;
    transform-origin: top left;
}

.rt-card__skeleton {
    position: absolute;
    inset: 0;
    background: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: opacity 0.3s ease;
}
.rt-card__skeleton.loaded {
    opacity: 0;
    pointer-events: none;
}
.rt-card__skeleton i {
    font-size: 1.5rem;
    color: var(--text-muted);
    animation: rt-pulse 1.5s ease-in-out infinite;
}
@keyframes rt-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.rt-empty {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
    color: var(--text-muted);
}
.rt-empty i {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--space-md);
    opacity: 0.4;
}
.rt-empty p {
    font-size: 0.95rem;
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Modal */
.rt-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
.rt-modal.active { display: flex; }
.rt-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}
.rt-modal__content {
    position: relative;
    container-type: inline-size;
    max-width: 90vw;
    max-height: 90vh;
    background: var(--bg-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.rt-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
.rt-modal__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-default);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.rt-modal__title .rt-card__res {
    font-size: 0.75rem;
}
.rt-modal__close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: color var(--transition-base);
}
.rt-modal__close:hover { color: var(--text-default); }
.rt-modal__body {
    flex: 1;
    overflow: clip;
    position: relative;
    align-self: center;
    background: var(--bg-base);
}
.rt-modal__body iframe {
    display: block;
    border: none;
    transform-origin: top left;
}

/* Diagnosis mode */
.rt-diag-actions {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-left: auto;
}
.rt-diag-btn {
    padding: 0.4rem 0.9rem;
    background: transparent;
    border: 1px solid var(--accent-cyan);
    border-radius: var(--radius-full);
    color: var(--accent-cyan);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.rt-diag-btn:hover {
    background: var(--accent-cyan);
    color: #000;
}
.rt-diag-reset {
    padding: 0.4rem 0.9rem;
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.rt-diag-reset:hover {
    border-color: var(--border-hover);
    color: var(--text-default);
}
.rt-diag-reset[hidden] { display: none; }

/* A card confirmed OK during a diagnosis */
.rt-card__check {
    font-size: 0.85rem;
    color: var(--accent-green, #4ade80);
    flex-shrink: 0;
    display: none;
}
.rt-card.is-approved .rt-card__check { display: block; }
.rt-card.is-approved { border-color: rgba(74, 222, 128, 0.35); }
.rt-card.is-approved .rt-card__viewport { opacity: 0.85; }

.rt-modal__progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 2px;
    width: 100%;
    background: var(--border-subtle);
    display: none;
}
.rt-modal.diag-active .rt-modal__progress { display: block; }
.rt-modal__progress span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent-cyan);
    transition: width 0.25s ease;
}

.rt-modal__counter {
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.12);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    display: none;
}
.rt-modal.diag-active .rt-modal__counter { display: inline-block; }

.rt-modal__nav {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
.rt-modal.diag-active .rt-modal__nav { display: flex; }
/* A phone-width modal cannot hold the nav — give diagnosis mode a floor. */
.rt-modal.diag-active .rt-modal__content { min-width: min(500px, 94vw); }
@container (max-width: 520px) {
    .rt-modal__nav-hint { display: none; }
}
.rt-modal__nav-mid {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 0;
}
.rt-modal__nav-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.rt-modal__nav-hint kbd {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-base);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.05rem 0.3rem;
    font-size: 0.65rem;
}
.rt-modal__nav-actions {
    display: flex;
    gap: var(--space-xs);
}
.rt-nav-btn {
    white-space: nowrap;
    padding: 0.4rem 0.9rem;
    background: var(--bg-base);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-default);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.rt-nav-btn:hover:not(:disabled) {
    border-color: var(--border-hover);
}
.rt-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.rt-nav-btn--icon {
    padding: 0.4rem 0.6rem;
    font-size: 1rem;
}
.rt-nav-btn--ok {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: #000;
    font-weight: 600;
}
.rt-nav-btn--ok:hover:not(:disabled) { opacity: 0.85; }
.rt-nav-btn--ok.is-approved {
    background: transparent;
    border-color: var(--accent-green, #4ade80);
    color: var(--accent-green, #4ade80);
}

@media (max-width: 640px) {
    .rt-diag-btn { margin-left: 0; }
    .rt-modal__nav-hint { display: none; }
    .rt-grid {
        grid-template-columns: 1fr;
    }
    .rt-url-bar {
        flex-direction: column;
    }
    .rt-modal__content {
        width: 98vw;
        max-height: 95vh;
    }
}
