/* DNS checker — hero uses speed-test-banner.css; inline record select + results + actions */

/* Record type <select> — looks like a clickable control inside the pill */
.speed-input-row.dns-hero-input-row .dns-record-select-hero {
    flex: 0 1 11.5rem;
    min-width: 7.5rem;
    max-width: 13rem;
    margin: 0.2rem 0 0.2rem 0.35rem;
    padding: 0.5rem 1.65rem 0.5rem 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
    color: #0f172a;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.55rem center;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 1px 2px rgba(15, 23, 42, 0.06);
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.speed-input-row.dns-hero-input-row .dns-record-select-hero:hover {
    background-color: #f8fafc;
    border-color: #94a3b8;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        0 2px 6px rgba(15, 23, 42, 0.08);
}

.speed-input-row.dns-hero-input-row .dns-record-select-hero:focus {
    border-color: #8b5cf6;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        0 0 0 2px rgba(139, 92, 246, 0.25);
}

.speed-test-form .form-help kbd {
    font-size: 0.75em;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.dns-hero-animate > * {
    animation: dnsHeroFadeIn 0.45s ease-out both;
}

.dns-hero-animate .speed-test-form {
    animation-delay: 0.06s;
}

.dns-hero-animate .speed-banner-points {
    animation-delay: 0.12s;
}

@keyframes dnsHeroFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* DNS results — light section below trust strip */
.dns-results-section {
    background: #f1f5f9;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    padding: 3rem 0 3.5rem;
}

@media (max-width: 991px) {
    .dns-results-section {
        padding: 1.25rem 0 2rem;
    }

    #dns-results-section .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

@media (min-width: 992px) {
    #dns-results-section .container {
        max-width: min(100vw - 2rem, 1680px);
        width: 100%;
    }
}

.dns-results-header {
    text-align: center;
    margin-bottom: 2rem;
}

.dns-results-header h2 {
    color: #0f172a;
    font-size: clamp(1.35rem, 3vw, 2rem);
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.25;
}

.results-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.record-type-badge {
    background: linear-gradient(135deg, #eb2b63, #b91c5c);
    color: white;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.locations-count {
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Results (left) + large sticky map (right), near full viewport height on desktop */
.dns-results-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, min(58vw, 1040px));
    gap: 1.5rem 1.75rem;
    align-items: stretch;
    margin-bottom: 2rem;
}

.dns-results-layout__map-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dns-results-layout__main-col {
    min-width: 0;
}

@media (min-width: 992px) {
    .dns-results-layout__map-col .dns-map-panel {
        position: sticky;
        top: calc(var(--hostcry-header-height, 72px) + 0.75rem);
        align-self: flex-start;
        width: 100%;
        display: flex;
        flex-direction: column;
        height: calc(100vh - var(--hostcry-header-height, 72px) - 1.5rem);
        max-height: calc(100vh - var(--hostcry-header-height, 72px) - 1.5rem);
        overflow: hidden;
        overscroll-behavior: auto;
    }

    .dns-results-layout__map-col .dns-map-panel .dns-map-panel__head {
        flex-shrink: 0;
    }

    .dns-results-layout__map-col .dns-map-panel .dns-leaflet-map-host {
        flex: 1 1 auto;
        min-height: 200px;
        position: relative;
    }

    .dns-results-layout__map-col .dns-map-panel .dns-leaflet-map {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100% !important;
    }

    .dns-results-layout__map-col .dns-map-panel .dns-map-panel__fallback,
    .dns-results-layout__map-col .dns-map-panel .dns-map-legend,
    .dns-results-layout__map-col .dns-map-panel .dns-map-attribution {
        flex-shrink: 0;
    }
}

@media (max-width: 991px) {
    .dns-results-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1.25rem;
    }

    /* Map above the list on small screens */
    .dns-results-layout__map-col {
        order: -1;
    }

    .dns-results-layout__main-col {
        order: 1;
    }

    .dns-results-layout__map-col .dns-map-panel {
        height: auto;
        max-height: none;
        overflow: visible;
        display: block;
        padding: 0.85rem 0.9rem;
    }

    .dns-results-layout__map-col .dns-map-panel .dns-leaflet-map-host {
        position: relative;
        min-height: 0;
    }

    .dns-results-layout__map-col .dns-map-panel .dns-leaflet-map {
        position: relative;
        inset: auto;
        height: min(48vh, 380px) !important;
    }

    .dns-results-layout__main-col .dns-results-grid {
        gap: 0;
    }
}

/* Propagation map (Leaflet) */
.dns-map-panel {
    margin-bottom: 0;
    padding: 1.25rem 1.35rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.dns-map-panel[hidden] {
    display: none !important;
}

.dns-map-panel__head {
    margin-bottom: 1rem;
    text-align: center;
}

.dns-map-panel__title {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

.dns-map-panel__hint {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.55;
    color: #64748b;
}

.dns-leaflet-map-host {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

/* Default / mobile height; desktop overrides with absolute fill inside flex host */
.dns-leaflet-map {
    height: min(48vh, 400px);
    width: 100%;
    background: #e2e8f0;
    z-index: 1;
}

/*
 * Static map: tiles + empty areas ignore pointer events so wheel/trackpad uses the
 * browser’s native page scroll (no JS scrollBy). Markers & popups stay interactive.
 */
.dns-map-panel .leaflet-container {
    cursor: default;
    pointer-events: none;
}

.dns-map-panel .leaflet-tile-pane,
.dns-map-panel .leaflet-overlay-pane,
.dns-map-panel .leaflet-shadow-pane,
.dns-map-panel .leaflet-control-container {
    pointer-events: none !important;
}

.dns-map-panel .leaflet-control-attribution {
    pointer-events: auto !important;
}

.dns-map-panel .leaflet-marker-pane {
    pointer-events: none !important;
}

.dns-map-panel .leaflet-marker-pane > * {
    pointer-events: auto !important;
}

.dns-map-panel .leaflet-popup-pane {
    pointer-events: none !important;
}

.dns-map-panel .leaflet-popup-pane .leaflet-popup {
    pointer-events: auto !important;
}

/* Leaflet divIcon markers (pending / success / error) */
.dns-leaflet-divicon {
    background: transparent !important;
    border: none !important;
}

.dns-map-marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.28);
    line-height: 1;
}

.dns-map-marker--pending {
    background: #64748b;
}

.dns-map-marker--ok {
    background: #059669;
}

.dns-map-marker--err {
    background: #dc2626;
}

.dns-map-marker--warn {
    background: #d97706;
}

.dns-map-panel__fallback {
    margin: 0.75rem 0 0;
    font-size: 0.875rem;
    color: #b45309;
    text-align: center;
}

.dns-map-panel__fallback.hidden {
    display: none !important;
}

.dns-map-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem 1.5rem;
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    font-size: 0.8125rem;
    color: #475569;
    font-weight: 500;
}

.dns-map-legend li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.dns-map-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.dns-map-dot--success {
    background: #10b981;
}

.dns-map-dot--warning {
    background: #f59e0b;
}

.dns-map-dot--error {
    background: #ef4444;
}

.dns-map-attribution {
    margin: 0.65rem 0 0;
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: center;
}

.dns-map-attribution a {
    color: #64748b;
    text-decoration: underline;
}

/* Loading / progress inside results (light) */
.dns-results-loading {
    padding: 2.5rem 1rem;
    color: #475569;
}

.dns-results-loading__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.35rem;
}

.dns-results-loading__text {
    margin: 0;
    font-size: 0.9rem;
    color: #64748b;
}

.dns-progress-container {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    text-align: center;
}

.dns-progress-bar-wrap {
    height: 8px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.dns-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #eb2b63, #8b5cf6);
    transition: width 0.25s ease;
}

.dns-progress-text {
    margin-top: 0.65rem;
    font-size: 0.875rem;
    color: #475569;
}

/* Summary strip */
.dns-summary {
    margin-top: 1.5rem;
    padding: 1.25rem 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    text-align: center;
}

.dns-summary__title {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

.dns-summary__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.dns-summary__value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.dns-summary__value--success {
    color: #059669;
}

.dns-summary__value--error {
    color: #dc2626;
}

.dns-summary__value--rate {
    color: #d97706;
}

.dns-summary__value--time {
    color: #4f46e5;
}

.dns-summary__label {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.2rem;
}

.dns-summary__footer {
    font-size: 0.8125rem;
    color: #94a3b8;
}

/* Location cards — single column beside sticky map */
.dns-results-layout__main-col .dns-results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 0;
}

/* Location row: mobile = location | records | status; desktop = card */
.dns-loc-row.location-result {
    transition: box-shadow 0.2s ease;
}

.dns-loc-row__inner {
    align-items: flex-start;
}

.dns-loc-row__loc {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    min-width: 0;
}

.dns-loc-row__flag {
    width: 40px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dns-loc-row__loc-text {
    min-width: 0;
    flex: 1 1 auto;
}

.dns-loc-row__location {
    font-weight: 600;
    color: #0f172a;
    font-size: 0.92rem;
    line-height: 1.35;
}

.dns-loc-row__provider {
    font-weight: 400;
    color: #64748b;
    font-size: 0.72rem;
    line-height: 1.3;
    margin-top: 0.12rem;
}

.dns-loc-row__status {
    flex-shrink: 0;
    line-height: 1;
    padding-top: 0.15rem;
}

.dns-loc-row__status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 50%;
    font-size: 0.55rem;
    line-height: 1;
}

.dns-loc-row__status-icon--success {
    background: #10b981;
    color: #fff;
}

.dns-loc-row__status-icon--warning {
    background: #f59e0b;
    color: #fff;
}

.dns-loc-row__status-icon--error {
    background: #ef4444;
    color: #fff;
}

@media (min-width: 992px) {
    .dns-loc-row__status-icon {
        width: 1.25rem;
        height: 1.25rem;
        font-size: 0.6rem;
    }
}

@media (max-width: 991px) {
    .dns-loc-row.location-result {
        background: transparent;
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 0.5rem 0;
        margin: 0;
        border-bottom: 1px solid #e2e8f0;
    }

    .dns-results-grid > .dns-loc-row.location-result:last-of-type {
        border-bottom: none;
    }

    .dns-loc-row__inner {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.45rem;
    }

    .dns-loc-row__loc {
        flex: 0 1 38%;
    }

    .dns-loc-row__location {
        font-size: 0.8rem;
        font-weight: 500;
    }

    .dns-loc-row__provider {
        font-size: 0.68rem;
    }

    .dns-loc-row__flag {
        width: 32px;
        height: 22px;
    }

    .dns-loc-row__records {
        flex: 1 1 auto;
        min-width: 0;
        text-align: right;
    }

    .dns-loc-row__records .records {
        display: block;
        background: transparent;
        border: none;
        padding: 0;
        margin: 0;
        font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
        font-size: 0.8rem;
        line-height: 1.45;
        white-space: pre-wrap;
        word-break: break-word;
        text-align: right;
        color: #2563eb;
    }

    .dns-loc-row.dns-warning .dns-loc-row__records .records {
        color: #b45309;
    }

    .dns-loc-row.dns-error .dns-loc-row__records .records {
        color: #b91c1c;
    }

    .dns-loc-row__status {
        align-self: center;
        padding-top: 0;
    }
}

@media (min-width: 992px) {
    .dns-loc-row.location-result {
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
        padding: 0;
    }

    .dns-loc-row.location-result:hover {
        box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
        transform: translateY(-1px);
    }

    .dns-loc-row__inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        column-gap: 1rem;
        row-gap: 0.65rem;
        padding: 1rem 1.15rem 1rem;
        align-items: start;
    }

    .dns-loc-row__loc {
        grid-column: 1;
        grid-row: 1;
    }

    .dns-loc-row__status {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        padding-top: 0.2rem;
    }

    .dns-loc-row__records {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

.records {
    color: #334155;
    font-size: 0.875rem;
    line-height: 1.45;
    font-family: ui-monospace, 'Cascadia Code', 'Menlo', 'Monaco', monospace;
    background: #f8fafc;
    padding: 0.65rem 0.7rem;
    border-radius: 8px;
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid #e2e8f0;
}

.records.error {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Quick Actions */
.dns-quick-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    letter-spacing: 0.5px;
}

.action-btn.primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.action-btn.primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.action-btn.secondary {
    background: #fff;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.action-btn.secondary:hover {
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

/* Loading state (class added by checker.blade.php) */
.btn-speed-primary.dns-search-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.btn-speed-primary.dns-search-btn.loading {
    position: relative;
    color: transparent !important;
}

.btn-speed-primary.dns-search-btn.loading i,
.btn-speed-primary.dns-search-btn.loading span {
    visibility: hidden;
}

.btn-speed-primary.dns-search-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    transform: rotate(0deg);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .speed-input-row.dns-hero-input-row .dns-record-select-hero {
        flex: 1 1 auto;
        max-width: none;
        width: 100%;
        margin: 0.35rem 0 0;
        padding: 0.7rem 1.75rem 0.7rem 0.85rem;
        font-size: 16px;
        border-radius: 12px;
        background-position: right 0.65rem center;
    }

    .dns-quick-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-btn {
        justify-content: center;
    }
    
    .dns-loc-row.location-result {
        width: 100%;
        box-sizing: border-box;
    }

    .dns-loc-row__records .records {
        width: 100%;
        box-sizing: border-box;
    }

    /* Make DNS results container consistent width on mobile */
    #result {
        width: 100%;
        margin: 0;
        padding: 0;
    }
    
    /* Add spacing between DNS summary and quick actions */
    .dns-summary {
        margin-bottom: 25px;
    }
    
    /* Ensure consistent spacing for DNS quick actions */
    .dns-quick-actions {
        margin-top: 20px;
        padding-top: 15px;
    }
}

@media (max-width: 480px) {
    .dns-leaflet-map {
        height: min(240px, 45vh) !important;
    }

    .dns-loc-row__flag {
        width: 28px;
        height: 19px;
    }

    .dns-loc-row__location {
        font-size: 0.76rem;
    }

    .dns-loc-row__records .records {
        font-size: 0.74rem;
    }
}

/* Success and Error States (desktop cards; flat rows omit side accent) */
@media (min-width: 992px) {
    .dns-loc-row.dns-success {
        border-left: 4px solid #10b981;
    }

    .dns-loc-row.dns-error {
        border-left: 4px solid #ef4444;
    }

    .dns-loc-row.dns-warning {
        border-left: 4px solid #f59e0b;
    }
}

/* Status indicators */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-success {
    background-color: #10b981;
}

.status-error {
    background-color: #ef4444;
}

.status-warning {
    background-color: #f59e0b;
}

/* Enhanced focus states for accessibility */
.speed-input-row.dns-hero-input-row:focus-within {
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(139, 92, 246, 0.35);
}

.action-btn:focus {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .speed-banner-modern,
    .speed-trust-strip,
    .dns-quick-actions {
        display: none;
    }

    .dns-results-layout {
        grid-template-columns: 1fr;
    }

    .dns-results-layout__map-col .dns-map-panel {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .dns-results-section {
        background: white;
        color: black;
    }

    .dns-results-layout__map-col,
    .dns-results-layout__main-col {
        order: 0;
    }

    .dns-loc-row.location-result {
        background: white;
        border: 1px solid #ccc;
        color: black;
    }
}