/* Green Road - Website Carbon Footprint Analyzer Styles */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header h1 a {
    color: white;
    text-decoration: none;
}

header h1 a:hover {
    opacity: 0.9;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Analyzer Form */
.analyzer-form {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-bottom: 60px;
    width: 100%;
    max-width: 600px;
}

.input-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

input[type="url"] {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

input[type="url"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 120px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

button:active {
    transform: translateY(0);
}

.btn-loading {
    display: none;
}

/* Error Messages */
.error-message {
    color: #e74c3c;
    background: #fdf2f2;
    padding: 10px 15px;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
    font-size: 14px;
}

/* Info Section */
.info-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 800px;
    margin-bottom: 40px;
}

.info-section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 2rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.info-item {
    text-align: center;
    padding: 20px;
}

.info-item h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #667eea;
}

.info-item p {
    color: #666;
    line-height: 1.6;
}

/* Loading Overlay Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(102, 126, 234, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-in;
}

.loading-content {
    background: white;
    padding: 50px 40px;
    border-radius: 25px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.3);
    max-width: 600px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.5s ease-out;
}

.loading-spinner-large {
    width: 80px;
    height: 80px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.loading-content h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.loading-url {
    color: #666;
    margin-bottom: 40px;
    font-size: 1rem;
}

.loading-url strong {
    color: #667eea;
    word-break: break-all;
}

.patience-message {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    margin: 30px 0;
    border-left: 4px solid #667eea;
}

.patience-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.patience-message h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.patience-message p {
    color: #666;
    line-height: 1.6;
    margin: 0;
}

.loading-progress {
    margin: 30px 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    animation: progressMove 3s ease-in-out infinite;
}

@keyframes progressMove {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.progress-text {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
    animation: textFade 2s ease-in-out infinite;
}

@keyframes textFade {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.loading-tips {
    background: #e8f4fd;
    padding: 25px;
    border-radius: 15px;
    margin-top: 30px;
    text-align: left;
}

.loading-tips h4 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    text-align: center;
}

.loading-tips ul {
    margin: 0;
    padding-left: 20px;
    color: #555;
}

.loading-tips li {
    margin-bottom: 8px;
    line-height: 1.4;
}

/* Results Styles */
.results-section {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 800px;
    margin-bottom: 40px;
}

.url-info {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.url {
    color: #667eea;
    font-weight: 500;
    word-break: break-all;
}

.fallback-notice,
.partial-notice {
    background: #fff3cd;
    color: #856404;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    margin-top: 15px;
    font-size: 0.9rem;
}

.fallback-notice p,
.partial-notice p {
    margin: 0;
    line-height: 1.4;
}

.score-summary {
    text-align: center;
    margin-bottom: 40px;
}

.total-score {
    display: inline-block;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    color: white;
    font-weight: bold;
    position: relative;
}

.score-value {
    font-size: 2.5rem;
}

.score-max {
    font-size: 1rem;
    opacity: 0.8;
}

.score-label {
    font-size: 1.1rem;
    color: #666;
    margin: 0;
}

/* Error Section */
.error-section {
    text-align: center;
    background: white;
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    max-width: 600px;
    width: 100%;
}

.error-section h2 {
    color: #e74c3c;
    margin-bottom: 20px;
}

.error-details {
    text-align: left;
    margin-bottom: 30px;
}

.error-message {
    background: #fdf2f2;
    color: #e74c3c;
    padding: 15px 20px;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.5;
}

.error-suggestions {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    margin-bottom: 20px;
}

.error-suggestions h4 {
    color: #667eea;
    margin: 0 0 15px 0;
    font-size: 1.1rem;
}

.error-suggestions ul {
    margin: 0;
    padding-left: 20px;
    color: #666;
}

.error-suggestions li {
    margin-bottom: 8px;
    line-height: 1.4;
}

.retry-section {
    background: #fff3cd;
    color: #856404;
    padding: 15px 20px;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    margin-bottom: 20px;
}

.retry-message {
    margin: 0;
    font-weight: 500;
}

.technical-details {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    margin-bottom: 20px;
}

.technical-details h4 {
    color: #666;
    margin: 0 0 15px 0;
    font-size: 1rem;
}

.technical-details pre {
    background: #fff;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    font-size: 12px;
    color: #666;
    overflow-x: auto;
    margin: 0;
}

.error-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #f8f9fa;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

/* Score Breakdown Styles */
.score-breakdown {
    margin: 40px 0;
}

.score-breakdown h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

.breakdown-grid {
    display: grid;
    gap: 20px;
}

.breakdown-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.breakdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.breakdown-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #333;
}

.breakdown-weight {
    font-size: 0.9rem;
    color: #666;
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
}

.breakdown-score {
    display: flex;
    align-items: center;
    gap: 15px;
}

.score-bar {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.score-number {
    font-weight: 600;
    color: #333;
    min-width: 60px;
    text-align: right;
}

/* Green Hosting Styles */
.green-hosting {
    margin: 40px 0;
}

.green-hosting h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

.hosting-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 25px;
    border-radius: 12px;
    border: 2px solid;
}

.hosting-card.green {
    background: #d4edda;
    border-color: #27ae60;
    color: #155724;
}

.hosting-card.not-green {
    background: #f8d7da;
    border-color: #e74c3c;
    color: #721c24;
}

.hosting-icon {
    font-size: 3rem;
    line-height: 1;
}

.hosting-info h4 {
    margin: 0 0 10px 0;
    font-size: 1.3rem;
}

.hosting-info p {
    margin: 0 0 15px 0;
    line-height: 1.5;
}

.hosting-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Performance Metrics Styles */
.performance-metrics {
    margin: 40px 0;
}

.performance-metrics h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.metric-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.metric-card h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.1rem;
}

.metric-score {
    margin-bottom: 15px;
}

.metric-value {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

.metric-label {
    font-size: 1rem;
    color: #666;
    margin-left: 5px;
}

.metric-details {
    border-top: 1px solid #e9ecef;
    padding-top: 15px;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

/* Recommendations Styles */
.recommendations {
    margin: 40px 0;
}

.recommendations h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

.recommendations-list {
    display: grid;
    gap: 15px;
}

.recommendation-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid;
}

.recommendation-item.priority-high {
    border-left-color: #e74c3c;
}

.recommendation-item.priority-medium {
    border-left-color: #f39c12;
}

.recommendation-item.priority-low {
    border-left-color: #27ae60;
}

.recommendation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.recommendation-title {
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
}

.recommendation-impact {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.impact-high {
    background: #fee;
    color: #e74c3c;
}

.impact-medium {
    background: #fef9e7;
    color: #f39c12;
}

.impact-low {
    background: #eef;
    color: #27ae60;
}

.recommendation-description {
    color: #666;
    line-height: 1.5;
    margin: 0 0 10px 0;
}

.recommendation-savings {
    font-size: 0.9rem;
    color: #667eea;
    font-weight: 500;
}

/* Analysis Summary Styles */
.analysis-summary {
    margin: 40px 0;
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.analysis-summary h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.5rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-label {
    font-weight: 500;
    color: #666;
}

.summary-value {
    font-weight: 600;
    color: #333;
}

.summary-value.green {
    color: #27ae60;
}

.summary-value.not-green {
    color: #e74c3c;
}

.grade-a { color: #27ae60; }
.grade-b { color: #2ecc71; }
.grade-c { color: #f39c12; }
.grade-d { color: #e67e22; }
.grade-f { color: #e74c3c; }

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 2.5rem;
    }

    .analyzer-form,
    .loading-section,
    .results-section,
    .error-section {
        padding: 30px 20px;
    }

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

    .info-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .info-section {
        padding: 30px 20px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .hosting-card {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .recommendation-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-buttons {
        flex-direction: column;
        align-items: center;
    }

    .loading-content {
        padding: 40px 25px;
        width: 95%;
    }

    .loading-content h2 {
        font-size: 1.5rem;
    }

    .patience-message,
    .loading-tips {
        padding: 20px;
    }

    .loading-spinner-large {
        width: 60px;
        height: 60px;
        border-width: 4px;
    }
}

@media (max-width: 480px) {
    .loading-content {
        padding: 30px 20px;
        border-radius: 15px;
    }

    .loading-content h2 {
        font-size: 1.3rem;
    }

    .patience-message h3 {
        font-size: 1.1rem;
    }

    .loading-tips h4 {
        font-size: 1rem;
    }

    .patience-icon {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .analyzer-form,
    .loading-section,
    .results-section,
    .error-section {
        padding: 20px 15px;
    }

    .score-breakdown h3,
    .green-hosting h3,
    .performance-metrics h3,
    .recommendations h3,
    .analysis-summary h3 {
        font-size: 1.3rem;
    }

    .breakdown-item,
    .hosting-card,
    .metric-card,
    .recommendation-item,
    .analysis-summary {
        padding: 15px;
    }
}
