:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #ec4899;
    --bg-dark: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --critical: #ef4444;
    --radius: 16px;
    --transition: 0.3s ease;
    --font-main: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Animation */
.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite alternate;
}

.globe-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    top: -10%;
    left: -10%;
}

.globe-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    bottom: -10%;
    right: -10%;
    animation-delay: -5s;
}

@keyframes float {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(30px, 50px);
    }
}

/* Typography & Layout */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-header {
    text-align: center;
    padding: 60px 0 40px;
}

h1 {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 10px;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.highlight {
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.main-header p {
    font-size: 1.25rem;
    color: var(--text-muted);
}

/* Cards & Glassmorphism */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.36);
    margin-bottom: 24px;
}

.glass-card {
    transition: transform var(--transition);
}

/* Input Section */
.search-section {
    margin-bottom: 40px;
}

.search-section h2 {
    margin-bottom: 20px;
    font-weight: 500;
    text-align: center;
}

.input-group {
    display: flex;
    gap: 12px;
}

input[type="url"] {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    padding: 16px 24px;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

input[type="url"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

button {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.error-msg {
    color: var(--critical);
    margin-top: 10px;
    font-size: 0.9rem;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Loader */
.loader {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* Summary Card */
.score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
}

.score-circle span {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

.score-circle small {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}

.badge.critical {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge.good {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Detailed Report */
.detailed-report h3 {
    margin-bottom: 24px;
    font-size: 1.5rem;
}

.category-group {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.category-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
}

.category-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
}

.issue-list {
    padding: 0 20px 20px;
}

.issue-item {
    padding: 16px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border-left: 4px solid var(--text-muted);
}

.issue-item.critical {
    border-left-color: var(--critical);
}

.issue-item.warning {
    border-left-color: var(--warning);
}

.issue-item.good {
    border-left-color: var(--success);
}

.issue-title {
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
}

.issue-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.fix-suggestion {
    font-size: 0.9rem;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 8px;
}

.fix-suggestion strong {
    color: var(--primary);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    width: 100%;
    margin-top: 20px;
}

.btn-secondary:hover {
    background: var(--glass-bg);
    color: white;
    transform: none;
    box-shadow: none;
}

/* Footer */
.main-footer {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2.5rem;
    }

    .input-group {
        flex-direction: column;
    }

    button {
        width: 100%;
    }
}

.retry-btn {
    background: transparent;
    border: 1px solid var(--critical);
    color: var(--critical);
    margin-top: 10px;
    padding: 8px 16px;
    font-size: 0.9rem;
    min-width: auto;
}

.retry-btn:hover {
    background: var(--critical);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}
/* Visual Feedback Styles */
.issue-details-list { margin-top: 15px; display: flex; flex-wrap: wrap; gap: 10px; }
.img-preview-item { display: flex; align-items: center; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; padding: 5px; max-width: 100%; }
.img-thumbnail { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; margin-right: 10px; background-color: #000; }
.img-meta { font-size: 0.85rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.img-meta strong { color: var(--text-primary); display: block; margin-bottom: 2px; }
.img-link { color: var(--primary); text-decoration: none; font-size: 0.8rem; }
.img-link:hover { text-decoration: underline; }

/* Phase 2.1 Modal Styles */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); z-index: 1000; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.modal.show { opacity: 1; pointer-events: auto; }
.modal-content { background: #1e293b; width: 90%; max-width: 800px; max-height: 80vh; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.1); padding: 30px; position: relative; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,0.5); transform: translateY(20px); transition: transform 0.3s ease; }
.modal.show .modal-content { transform: translateY(0); }
.close-modal { position: absolute; top: 20px; right: 25px; font-size: 28px; cursor: pointer; color: #94a3b8; transition: color 0.2s; }
.close-modal:hover { color: white; }
.modal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; overflow-y: auto; margin-top: 20px; padding-right: 10px; }
.view-details-btn { 
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2)); 
    border: 1px solid rgba(255, 255, 255, 0.2); 
    color: white; 
    padding: 8px 16px; 
    border-radius: 8px; 
    cursor: pointer; 
    font-size: 0.9rem; 
    margin-top: 12px; 
    transition: all 0.2s; 
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.view-details-btn:hover { 
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(236, 72, 153, 0.4)); 
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

/* Phase 3 Vitals & Waterfall */
.vitals-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 20px; }
.vital-card { background: rgba(255,255,255,0.05); padding: 15px; border-radius: 12px; text-align: center; }
.vital-score { font-size: 2rem; font-weight: 700; display: block; margin-bottom: 5px; }
.vital-bar { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.vital-fill { height: 100%; width: 0%; background: #10b981; transition: width 1s ease; }

.screenshot-wrapper { 
    cursor: pointer; 
    transition: transform 0.3s ease; 
    position: relative; 
}

.screenshot-wrapper:hover { 
    transform: scale(1.02); 
}

.screenshot-wrapper::after { 
    content: 'Click to Expand'; 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    background: rgba(0,0,0,0.7); 
    padding: 8px 16px; 
    border-radius: 20px; 
    opacity: 0; 
    transition: opacity 0.3s; 
    pointer-events: none; 
    font-size: 0.9rem; 
    font-weight: 500; 
}

.screenshot-wrapper:hover::after { 
    opacity: 1; 
}

.screenshot-wrapper img { width: 100%; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
#waterfallChart { max-height: 400px; }
/* Single View Modal */
.modal-grid.single-view { display: flex; justify-content: center; padding: 0; }
.modal-grid.single-view .img-preview-item { width: 100%; max-width: 100%; background: transparent; border: none; flex-direction: column; }
.modal-grid.single-view .img-thumbnail { width: auto; max-width: 100%; height: auto; max-height: 70vh; margin: 0 0 10px 0; }
