/* Speed Test Styles */
.sap-speed-test {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Progress text styling */
.sap-progress-message {
    font-size: 20px;
    color: white;
    font-weight: 500;
    margin-bottom: 10px;
}

.sap-progress-title {
    color: white !important;
    font-size: 28px !important;
    font-weight: 600;
    margin: 20px 0 15px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Progress Section */
.sap-speed-progress {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    margin: 30px 0;
}

.sap-speed-progress h3 {
    color: white;
    font-size: 24px;
    font-weight: 600;
    margin: 20px 0 10px 0;
}

.sap-speed-progress .sap-progress-text {
    color: white !important;
    font-size: 18px;
    margin: 15px 0;
    opacity: 1;
    min-height: 28px;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: opacity 0.2s ease;
}

.sap-progress-container {
    max-width: 400px;
    margin: 0 auto;
}

.sap-progress-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.sap-progress-countdown {
    font-size: 20px;
    margin-top: 15px;
    color: white !important;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    opacity: 0.95;
}

/* Device Switcher */
.sap-device-switcher {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 30px 0;
}

.sap-device-btn {
    padding: 12px 24px;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
}

.sap-device-btn:hover {
    background: #e8e8e8;
}

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

/* Speed Score Circle */
.sap-speed-score-container {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    margin: 20px 0;
}

.sap-speed-score-circle {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
}

.sap-score-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.sap-score-bg {
    fill: none;
    stroke: #f0f0f0;
    stroke-width: 10;
}

.sap-score-progress {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-in-out;
}

.sap-score-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.sap-score-number {
    font-size: 48px;
    font-weight: bold;
    display: block;
    line-height: 1;
    color: white;
}

.sap-score-label {
    font-size: 14px;
    color: white;
    margin-top: 5px;
    display: block;
    font-weight: 500;
}

.sap-speed-device-title {
    font-size: 24px;
    margin: 0;
    color: white;
    font-weight: 600;
}

/* Metrics Grid */
.sap-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 30px 0;
    padding: 0 20px;
}

.sap-metric-item {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 24px 20px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.sap-metric-item:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
    border-color: #d0d0d0;
}

.sap-metric-item.good {
    border-top: 4px solid #4caf50;
}

.sap-metric-item.average {
    border-top: 4px solid #ff9800;
}

.sap-metric-item.poor {
    border-top: 4px solid #f44336;
}

.sap-metric-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.sap-metric-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.sap-metric-description {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
}

.sap-metric-value {
    font-size: 32px;
    font-weight: bold;
    color: #333;
    margin: 15px 0;
}

.sap-metric-item.good .sap-metric-value {
    color: #4caf50;
}

.sap-metric-item.average .sap-metric-value {
    color: #ff9800;
}

.sap-metric-item.poor .sap-metric-value {
    color: #f44336;
}

.sap-metric-thresholds {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0 15px;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
}

.sap-metric-thresholds .threshold {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 4px;
}

.sap-metric-thresholds .threshold.good {
    background: rgba(76, 175, 80, 0.08);
}

.sap-metric-thresholds .threshold.needs-improvement {
    background: rgba(255, 152, 0, 0.08);
}

.sap-metric-thresholds .threshold.poor {
    background: rgba(244, 67, 54, 0.08);
}

.sap-metric-help {
    font-size: 12px;
    color: #888;
    margin-top: 10px;
    font-style: italic;
}

/* Cache Notice */
.sap-cache-notice {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #fff3cd, #ffe4b1);
    border: 1px solid #ffc107;
    border-radius: 8px;
    margin-bottom: 20px;
}

.sap-cache-notice .cache-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sap-cache-notice .cache-icon {
    font-size: 20px;
}

.sap-cache-notice .cache-text {
    font-size: 14px;
    color: #856404;
    font-weight: 500;
}

.sap-refresh-btn {
    background: white;
    border: 2px solid #ffc107;
    color: #856404;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sap-refresh-btn:hover {
    background: #ffc107;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255, 193, 7, 0.3);
}

/* Recommendations */
.sap-speed-recommendations {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 30px;
    margin-top: 40px;
}

.sap-speed-recommendations h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 20px;
    color: #333;
}

.sap-recommendation-item {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.sap-recommendation-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.sap-recommendation-item.error {
    border-left: 4px solid #f44336;
}

.sap-recommendation-item.warning {
    border-left: 4px solid #ff9800;
}

.sap-recommendation-item.success {
    border-left: 4px solid #4caf50;
}

.sap-rec-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.sap-rec-icon {
    font-size: 20px;
}

.sap-rec-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    flex: 1;
}

.sap-rec-message {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.5;
}

.sap-rec-tip {
    background: #f0f7ff;
    border: 1px solid #d0e5ff;
    border-radius: 6px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #444;
}

.no-recommendations {
    text-align: center;
    padding: 30px;
    color: #4caf50;
    font-size: 16px;
    background: white;
    border-radius: 10px;
    border: 2px solid #4caf50;
}

.sap-recommendation-item {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid #e0e0e0;
}

.sap-recommendation-item.error {
    border-left-color: #f44336;
    background: #fff5f5;
}

.sap-recommendation-item.warning {
    border-left-color: #ff9800;
    background: #fffaf0;
}

.sap-recommendation-item.success {
    border-left-color: #4caf50;
    background: #f5fff5;
}

.sap-rec-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.sap-rec-icon {
    font-size: 20px;
}

.sap-rec-title {
    font-weight: 600;
    color: #333;
    flex: 1;
}

.device-badge {
    font-size: 16px;
    padding: 2px 8px;
    background: #f0f0f0;
    border-radius: 4px;
}

.sap-rec-message {
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
}

.sap-rec-tip {
    background: #f0f8ff;
    border-radius: 6px;
    padding: 12px;
    margin-top: 10px;
    font-size: 14px;
    color: #333;
}

.sap-rec-details {
    margin: 10px 0;
    padding: 10px;
    background: #fafafa;
    border-radius: 4px;
    font-size: 13px;
}

.sap-rec-details strong {
    color: #333;
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.sap-rec-details ul {
    margin: 0;
    padding-left: 20px;
    list-style-type: disc;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
    background: white;
}

.sap-rec-details li {
    margin: 6px 0;
    color: #555;
    line-height: 1.6;
    word-break: break-word;
}

.sap-rec-details li a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.sap-rec-details li a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.sap-rec-details li em {
    color: #888;
    font-style: italic;
}

.audit-files-list {
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* Actions */
.sap-speed-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 40px;
    flex-wrap: wrap;
}

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

    .sap-device-switcher {
        flex-direction: column;
        align-items: center;
    }

    .sap-device-btn {
        width: 200px;
    }

    .sap-speed-actions {
        flex-direction: column;
        align-items: center;
    }

    .sap-speed-actions .sap-button {
        width: 100%;
        max-width: 300px;
    }
}