/**
 * WP Site Performance Detection - Speed Test Styles v1.0.0
 */

/* ==================== Container ==================== */
.wp-spd-st-container {
    max-width: 960px;
    margin: 0 auto;
    color: #1e1e1e;
    line-height: 1.6;
}
.wp-spd-st-container * { box-sizing: border-box; }

/* ==================== Search Form ==================== */
.wp-spd-st-form {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.wp-spd-st-input-group {
    display: flex;
    gap: 10px;
    align-items: stretch;
}
.wp-spd-st-url-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
    outline: none;
}
.wp-spd-st-url-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34,113,177,0.12);
}
.wp-spd-st-submit-btn {
    padding: 14px 32px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.wp-spd-st-submit-btn:hover { background: #135e96; }
.wp-spd-st-submit-btn:disabled { background: #a7aaad; cursor: not-allowed; }

/* ==================== Messages ==================== */
.wp-spd-st-error {
    background: #fcf0f1;
    border: 1px solid #d63638;
    color: #d63638;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* ==================== Loading ==================== */
.wp-spd-st-loading {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    margin-bottom: 20px;
}
.wp-spd-st-loading-spinner {
    width: 40px; height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: wp-spd-st-spin 0.7s linear infinite;
    margin: 0 auto 14px;
}
@keyframes wp-spd-st-spin { to { transform: rotate(360deg); } }
.wp-spd-st-loading p { color: #646970; font-size: 15px; margin: 0; }

/* ==================== Results ==================== */
.wp-spd-st-results { display: none; }
.wp-spd-st-results.visible { display: block; }

/* ==================== Section ==================== */
.wp-spd-st-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
}
.wp-spd-st-section-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 16px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    color: #1e1e1e;
}

/* ==================== Overview ==================== */
.wp-spd-st-overview-row {
    display: flex;
    gap: 20px;
    align-items: stretch;
}
.wp-spd-st-screenshot-wrap {
    flex: 0 0 400px;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
    max-height: 300px;
}
.wp-spd-st-screenshot-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.wp-spd-st-metrics {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    align-content: start;
}
.wp-spd-st-metric-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80px;
}
.wp-spd-st-metric-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #646970;
    margin-bottom: 6px;
}
.wp-spd-st-metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #1e1e1e;
}
.wp-spd-st-metric-value.grade-A { color: #00a32a; }
.wp-spd-st-metric-value.grade-B { color: #2271b1; }
.wp-spd-st-metric-value.grade-C { color: #dba617; }
.wp-spd-st-metric-value.grade-D { color: #e67700; }
.wp-spd-st-metric-value.grade-F { color: #d63638; }

/* Share row */
.wp-spd-st-share-row {
    margin-top: 16px;
    padding: 12px 16px;
    background: #f0f6fc;
    border-radius: 8px;
    font-size: 13px;
}
.wp-spd-st-share-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.wp-spd-st-share-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.wp-spd-st-share-label {
    font-weight: 600;
    color: #3c434a;
    white-space: nowrap;
}
.wp-spd-st-share-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}
.wp-spd-st-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #fff;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.15s;
    flex-shrink: 0;
    border: 1px solid #e0e0e0;
}
.wp-spd-st-share-btn:hover { opacity: 0.8; transform: translateY(-1px); }
.wp-spd-st-share-btn.twitter { color: #000; }
.wp-spd-st-share-btn.facebook { color: #1877f2; }
.wp-spd-st-share-btn.reddit { color: #ff4500; }
.wp-spd-st-share-url {
    flex: 1;
    min-width: 0;
    word-break: break-all;
    color: #2271b1;
}
.wp-spd-st-copy-btn {
    padding: 6px 16px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.wp-spd-st-copy-btn:hover { background: #135e96; }
.wp-spd-st-copy-btn.copied { background: #00a32a; }

/* Ad Slot */
.wp-spd-st-ad-slot {
    margin-bottom: 20px;
    text-align: center;
    min-height: 90px;
}

/* ==================== Suggestions ==================== */
.wp-spd-st-suggestion-group {
    margin-bottom: 24px;
}
.wp-spd-st-suggestion-group-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e1e1e;
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #f0f0f0;
}

/* Lab Data grid */
.wp-spd-st-lab-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.wp-spd-st-lab-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 14px;
    text-align: center;
}
.wp-spd-st-lab-item-label {
    font-size: 11px;
    color: #646970;
    margin-bottom: 4px;
}
.wp-spd-st-lab-item-value {
    font-size: 20px;
    font-weight: 700;
}
.wp-spd-st-lab-item-value.good { color: #00a32a; }
.wp-spd-st-lab-item-value.needs-improvement { color: #dba617; }
.wp-spd-st-lab-item-value.poor { color: #d63638; }

/* Audit items */
.wp-spd-st-audit-item {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}
.wp-spd-st-audit-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.wp-spd-st-audit-header:hover { background: #fafafa; }
.wp-spd-st-audit-icon {
    width: 20px; height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.wp-spd-st-audit-icon.pass { color: #00a32a; }
.wp-spd-st-audit-icon.warn { color: #dba617; }
.wp-spd-st-audit-icon.fail { color: #d63638; }
.wp-spd-st-audit-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
}
.wp-spd-st-audit-display {
    font-size: 12px;
    color: #646970;
    white-space: nowrap;
}
.wp-spd-st-audit-arrow {
    font-size: 10px;
    color: #a7aaad;
    transition: transform 0.2s;
}
.wp-spd-st-audit-item.open .wp-spd-st-audit-arrow { transform: rotate(90deg); }
.wp-spd-st-audit-body {
    display: none;
    padding: 0 14px 14px;
    font-size: 13px;
    color: #50575e;
    line-height: 1.6;
}
.wp-spd-st-audit-item.open .wp-spd-st-audit-body { display: block; }
.wp-spd-st-audit-body p { margin: 0 0 8px 0; }
.wp-spd-st-audit-body a { color: #2271b1; }

/* Audit table */
.wp-spd-st-audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 8px;
}
.wp-spd-st-audit-table th {
    text-align: left;
    padding: 6px 10px;
    background: #f8f9fa;
    font-weight: 600;
    color: #3c434a;
    border-bottom: 2px solid #e0e0e0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.wp-spd-st-audit-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #f0f0f0;
    word-break: break-all;
}
.wp-spd-st-audit-table td:first-child { max-width: 300px; }

/* ==================== Waterfall Table ==================== */
.wp-spd-st-waterfall-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.wp-spd-st-waterfall-table th {
    text-align: left;
    padding: 8px 10px;
    background: #f8f9fa;
    font-weight: 600;
    color: #3c434a;
    border-bottom: 2px solid #e0e0e0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.wp-spd-st-waterfall-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.wp-spd-st-waterfall-table .wp-spd-st-wf-file {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
}
.wp-spd-st-waterfall-table .wp-spd-st-wf-status {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.wp-spd-st-wf-status.status-200 { color: #00a32a; }
.wp-spd-st-wf-status.status-redirect { color: #dba617; }
.wp-spd-st-wf-status.status-error { color: #d63638; }
.wp-spd-st-wf-size {
    white-space: nowrap;
    color: #50575e;
}
.wp-spd-st-wf-timeline {
    min-width: 120px;
    position: relative;
}
.wp-spd-st-wf-bar-wrap {
    height: 14px;
    background: #f0f0f0;
    border-radius: 7px;
    overflow: hidden;
    position: relative;
}
.wp-spd-st-wf-bar {
    height: 100%;
    border-radius: 7px;
    min-width: 4px;
}
.wp-spd-st-wf-bar.type-css { background: #2271b1; }
.wp-spd-st-wf-bar.type-js { background: #dba617; }
.wp-spd-st-wf-bar.type-image { background: #00a32a; }
.wp-spd-st-wf-bar.type-document { background: #646970; }
.wp-spd-st-wf-bar.type-redirect { background: #d63638; }
.wp-spd-st-wf-bar.type-font { background: #8c6ac4; }
.wp-spd-st-wf-time {
    font-size: 10px;
    color: #a7aaad;
    margin-top: 2px;
}
.wp-spd-st-waterfall-summary {
    background: #f8f9fa;
    font-weight: 600;
}
.wp-spd-st-waterfall-summary td { border-top: 2px solid #e0e0e0; }

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .wp-spd-st-container { padding: 0 12px; overflow-x: hidden; }
    .wp-spd-st-form { padding: 16px; }
    .wp-spd-st-input-group { flex-direction: column; }
    .wp-spd-st-submit-btn { width: 100%; }
    .wp-spd-st-section { padding: 16px 14px; border-radius: 8px; margin-bottom: 16px; }
    /* Overview: stack vertically on mobile */
    .wp-spd-st-overview-row { flex-direction: column; gap: 12px; }
    .wp-spd-st-screenshot-wrap {
        flex: 0 0 auto;
        max-height: 220px;
        width: 100%;
    }
    .wp-spd-st-metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .wp-spd-st-metric-card { padding: 14px 10px; min-height: 65px; }
    .wp-spd-st-metric-value { font-size: 20px; }
    .wp-spd-st-lab-grid { grid-template-columns: repeat(2, 1fr); }
    /* Share row: keep top/bottom layout, just adjust sizing */
    .wp-spd-st-share-row { padding: 10px 12px; }
    .wp-spd-st-share-url { font-size: 12px; }
    .wp-spd-st-share-top { flex-wrap: wrap; }
    .wp-spd-st-audit-header { flex-wrap: wrap; }
    .wp-spd-st-waterfall-table { font-size: 11px; }
    .wp-spd-st-waterfall-table .wp-spd-st-wf-file { max-width: 150px; }
    .wp-spd-st-wf-timeline { min-width: 80px; }
    .wp-spd-st-ad-slot { min-height: 60px; margin-bottom: 16px; }
}
@media (max-width: 480px) {
    .wp-spd-st-container { padding: 0 8px; }
    .wp-spd-st-metrics { grid-template-columns: 1fr 1fr; }
    .wp-spd-st-lab-grid { grid-template-columns: 1fr; }
    .wp-spd-st-audit-table { font-size: 10px; }
    .wp-spd-st-audit-table th,
    .wp-spd-st-audit-table td { padding: 4px 6px; }
    .wp-spd-st-screenshot-wrap { max-height: 180px; }
    .wp-spd-st-metric-value { font-size: 18px; }
    .wp-spd-st-share-btn { width: 28px; height: 28px; }
}
