/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

.header h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Input Section */
.input-section {
    padding: 60px 40px;
    background: #f8fafc;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
}

.input-box h2 {
    font-size: 1.8rem;
    color: #1e293b;
    margin-bottom: 30px;
    font-weight: 600;
}

.input-group {
    display: flex;
    gap: 10px;
    max-width: 700px;
    margin: 0 auto 15px;
}

.input-group input {
    flex: 1;
    padding: 18px 25px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1.1rem;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.analyze-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 18px 35px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

.analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}

.note {
    color: #64748b;
    font-size: 0.9rem;
}

/* Loading */
.loading-section {
    padding: 80px 40px;
    text-align: center;
    background: #f8fafc;
}

.loading-box {
    max-width: 500px;
    margin: 0 auto;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #e2e8f0;
    border-top-color: #4f46e5;
    border-radius: 50%;
    margin: 0 auto 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-box h3 {
    font-size: 1.5rem;
    color: #1e293b;
    margin-bottom: 10px;
}

#loadingText {
    color: #64748b;
    margin-bottom: 30px;
}

.progress {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    width: 0%;
    transition: width 0.3s;
    border-radius: 4px;
}

/* Results Section */
.results-section {
    padding: 0;
}

/* Top Bar */
.top-bar {
    background: #f8fafc;
    padding: 15px 40px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
}

.top-buttons {
    display: flex;
    gap: 10px;
}

.top-btn, .download-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #64748b;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.download-btn {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
}

.download-btn:hover {
    background: #4338ca;
}

.top-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

/* Main Results */
.main-results {
    padding: 30px 40px;
    border-bottom: 1px solid #e2e8f0;
}

.main-results h2 {
    font-size: 1.5rem;
    color: #1e293b;
    margin-bottom: 20px;
}

#resultUrl {
    color: #4f46e5;
    font-weight: 600;
}

.score-section {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 15px;
}

.big-score {
    font-size: 4rem;
    font-weight: 800;
    color: #3b82f6;
    line-height: 1;
}

.score-text {
    font-size: 1.3rem;
    color: #64748b;
    flex: 1;
}

.recommendation-count {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    padding: 8px 16px;
    border-radius: 20px;
    color: #475569;
    font-size: 0.95rem;
}

.report-date {
    color: #94a3b8;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Chart Section */
.chart-section {
    padding: 30px 40px;
    border-bottom: 1px solid #e2e8f0;
}

.chart-section h3 {
    font-size: 1.3rem;
    color: #1e293b;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-container {
    height: 300px;
    position: relative;
    margin-bottom: 25px;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #64748b;
}

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Recommendations */
.recommendations-section {
    padding: 30px 40px;
    border-bottom: 1px solid #e2e8f0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h3 {
    font-size: 1.3rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn.active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: white;
}

.filter-btn:hover:not(.active) {
    border-color: #cbd5e1;
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.recommendation-item {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    border-left: 4px solid #e2e8f0;
    transition: all 0.3s;
}

.recommendation-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.recommendation-item.high { border-left-color: #ef4444; }
.recommendation-item.medium { border-left-color: #f59e0b; }
.recommendation-item.low { border-left-color: #10b981; }

.recommendation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.recommendation-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    flex: 1;
}

.recommendation-priority {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-high { background: #fee2e2; color: #dc2626; }
.priority-medium { background: #fef3c7; color: #d97706; }
.priority-low { background: #d1fae5; color: #059669; }

.recommendation-category {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 10px;
    display: block;
}

.recommendation-description {
    color: #475569;
    line-height: 1.5;
    font-size: 0.95rem;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 30px 40px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h4 {
    font-size: 1.2rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-score {
    font-size: 1.8rem;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 10px;
}

.onpage-card .card-score { color: #10b981; background: #d1fae5; }
.links-card .card-score { color: #3b82f6; background: #dbeafe; }
.usability-card .card-score { color: #ef4444; background: #fee2e2; }
.performance-card .card-score { color: #f59e0b; background: #fef3c7; }
.social-card .card-score { color: #8b5cf6; background: #ede9fe; }

.card-summary {
    color: #475569;
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.4;
}

/* Checks */
.checks {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
}

.check-status {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    flex-shrink: 0;
}

.status-pass { background: #10b981; color: white; }
.status-fail { background: #ef4444; color: white; }
.status-warning { background: #f59e0b; color: white; }

.check-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
    font-size: 0.95rem;
}

.check-description {
    font-size: 0.85rem;
    color: #64748b;
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.stat {
    text-align: center;
    padding: 15px;
    background: #f8fafc;
    border-radius: 10px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #4f46e5;
    margin-bottom: 5px;
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Web Vitals */
.web-vitals h5 {
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 15px;
}

.vitals {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.vital {
    text-align: center;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
}

.vital-name {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 5px;
}

.vital-value {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.vital-value.good { color: #10b981; }
.vital-value.average { color: #f59e0b; }
.vital-value.poor { color: #ef4444; }

.vital-label {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.2;
}

/* Performance Bars */
.performance-bars {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.perf-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.perf-label {
    font-size: 0.9rem;
    color: #64748b;
    width: 100px;
}

.perf-value {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    width: 60px;
}

.perf-bar {
    flex: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.perf-fill {
    height: 100%;
    border-radius: 4px;
}

/* Social Icons */
.social-icons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.social-icon {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    background: #f8fafc;
}

.social-icon.missing {
    background: #fee2e2;
    border: 1px solid #ef4444;
}

.social-icon i {
    font-size: 1.2rem;
    width: 24px;
}

.social-icon.missing i { color: #ef4444; }

.social-icon span {
    font-size: 0.95rem;
    color: #1e293b;
    font-weight: 500;
}

/* Detailed Section */
.detailed-section {
    padding: 30px 40px;
    border-bottom: 1px solid #e2e8f0;
}

.detailed-section h3 {
    font-size: 1.3rem;
    color: #1e293b;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.onpage-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.detail-item {
    background: #f8fafc;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.detail-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.detail-icon.good { background: #d1fae5; color: #10b981; }
.detail-icon.warning { background: #fef3c7; color: #d97706; }
.detail-icon.error { background: #fee2e2; color: #ef4444; }

.detail-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
}

.detail-content {
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.5;
}

.detail-value {
    font-weight: 600;
    color: #1e293b;
    margin-top: 5px;
}

/* Promo Section */
.promo-section {
    padding: 40px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.promo-box {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.promo-box h4 {
    font-size: 1.3rem;
    color: #1e293b;
    margin-bottom: 15px;
}

.promo-box p {
    color: #475569;
    margin-bottom: 15px;
    line-height: 1.6;
}

.promo-sub {
    color: #64748b;
    font-size: 0.95rem;
    font-style: italic;
    margin-bottom: 20px;
}

.promo-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.promo-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.3);
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px;
    color: #64748b;
    font-size: 0.9rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.footer p {
    margin-bottom: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        border-radius: 10px;
        margin: 10px;
    }
    
    .header {
        padding: 30px 20px;
    }
    
    .header h1 {
        font-size: 2rem;
        flex-direction: column;
        gap: 10px;
    }
    
    .input-section {
        padding: 40px 20px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .main-results,
    .chart-section,
    .recommendations-section,
    .cards-grid,
    .detailed-section,
    .promo-section {
        padding: 20px;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .stats,
    .vitals {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filters {
        width: 100%;
        justify-content: center;
    }
    
    .score-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .big-score {
        font-size: 3rem;
    }
    
    .promo-section {
        grid-template-columns: 1fr;
    }
}

@media print {
    body * {
        visibility: hidden;
    }
    
    #resultsSection,
    #resultsSection * {
        visibility: visible;
    }
    
    #resultsSection {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 0;
        margin: 0;
        box-shadow: none;
    }
    
    .top-bar,
    .promo-section,
    .footer {
        display: none !important;
    }
}

/* Ensure elements are visible for PDF */
.results-section {
    background: white;
}

/* Fix for PDF rendering */
.card {
    page-break-inside: avoid;
}

.recommendation-item {
    page-break-inside: avoid;
}

.chart-container {
    page-break-inside: avoid;
}