.popup-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.popup-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Removed background and backdrop-filter to allow page interactions */
    /* background: rgba(0, 0, 0, 0.5); */
    /* backdrop-filter: blur(10px); */
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none; /* Allow clicks to pass through to page */
}

.popup-container.visible {
    opacity: 1;
    visibility: visible;
}

.popup-container.open {
    opacity: 1;
    visibility: visible;
}

.popup-container.visible .popup,
.popup-container.open .popup {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto; /* Re-enable pointer events only for the popup */
}

/* Popup Tab (sliding arrow from right) */
.popup-tab {
    position: fixed;
    top: 50%;
    right: -30px;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 25px 0 0 25px;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    pointer-events: auto; /* Tab should always be clickable */
}

.popup-tab.visible {
    display: flex;
    right: 0;
}

.popup-tab:hover {
    right: 0;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.popup-tab.open {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.popup-tab .arrow {
    transition: transform 0.3s ease;
}

.popup-tab:hover .arrow {
    transform: translateX(-3px);
}

/* Main Popup */
.popup-container .popup {
    background: white;
    border-radius: 24px;
    width: 380px;
    max-height: 75vh;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
    transform: translateX(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-family: inherit;
    pointer-events: auto; /* Popup itself should be interactive */
}

/* Header */
.popup-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 12px 20px;
    position: relative;
    overflow: hidden;
}

.popup-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.popup-subtitle {
    opacity: 0.9;
    font-size: 14px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.close-btn {
    position: absolute;
    top: 8px;
    right: 16px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    z-index: 2;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Tabs */
.tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.tab-button {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    color: #64748b;
    transition: all 0.2s ease;
    position: relative;
    font-size: 13px;
}

.tab-button.active {
    color: #667eea;
    background: white;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px 3px 0 0;
}

.tab-button:hover:not(.active) {
    background: #f1f5f9;
    color: #475569;
}

/* Tab Content */
.tab-content {
    padding: 16px;
    min-height: 280px;
    max-height: 350px;
    overflow-y: auto;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Data Cards */
.data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.data-card {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.data-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

.data-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.data-label {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.data-value {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.data-value.large {
    font-size: 24px;
}

/* Combined Score and Temperature Card */
.score-temp-card {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.score-temp-card::before {
    background: rgba(255, 255, 255, 0.1);
}

.score-section {
    flex: 1;
    text-align: center;
}

.score-section .data-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 9px;
    margin-bottom: 6px;
}

.score-section .data-value {
    color: white;
    font-size: 32px;
    margin-bottom: 2px;
}

.temp-section {
    flex: 1;
    padding-left: 16px;
}

.temp-bar {
    width: 100%;
    height: 10px;
    background: linear-gradient(90deg, #3b82f6, #fbbf24, #ef4444);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 6px;
    position: relative;
}

.temp-indicator {
    position: absolute;
    top: -1px;
    width: 3px;
    height: 12px;
    background: white;
    border-radius: 1.5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-1.5px);
}

.temp-text {
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-align: center;
}

.temp-fill.cool {
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
    width: 33%;
}

.temp-fill.warm {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    width: 66%;
}

.temp-fill.hot {
    background: linear-gradient(90deg, #f87171, #ef4444);
    width: 100%;
}

/* URL List */
.url-list {
    margin-top: 12px;
}

.url-item {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 6px;
    transition: all 0.2s ease;
}

.url-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.url-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.url-count {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.url-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
    font-size: 12px;
    line-height: 1.2;
}

.url-path {
    color: #64748b;
    font-size: 10px;
    word-break: break-all;
    line-height: 1.1;
}

/* Loading States */
.loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 500px) {
    .popup {
        width: 95vw;
        margin: 20px;
    }
    
    .data-grid {
        grid-template-columns: 1fr;
    }
    
    .popup-tab {
        right: -25px;
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .popup-tab:hover,
    .popup-tab.visible {
        right: 0;
    }
    
    .popup-container {
        justify-content: center;
        padding-right: 10px;
    }
}

/* Custom Scrollbar */
.tab-content::-webkit-scrollbar {
    width: 6px;
}

.tab-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.tab-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.tab-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}