/* ─── GBP Data Viewer Styles v1.0 ─────────────────────────────────────────── */

:root {
    --gbpdv-green: rgba(0, 118, 83, 0.87);
    --gbpdv-green-solid: #007653;
    --gbpdv-green-light: #e8f5f0;
    --gbpdv-green-hover: #005f43;
    --gbpdv-navy: #110f7c;
    --gbpdv-navy-light: #eeedf8;
    --gbpdv-text: #1a1a2e;
    --gbpdv-text-secondary: #555;
    --gbpdv-border: #dde1e6;
    --gbpdv-bg: #f7f8fa;
    --gbpdv-white: #ffffff;
    --gbpdv-error: #c0392b;
    --gbpdv-error-bg: #fdf0ef;
    --gbpdv-radius: 8px;
    --gbpdv-shadow: 0 2px 8px rgba(0,0,0,0.06);
    --gbpdv-shadow-hover: 0 4px 16px rgba(0,0,0,0.1);
}

/* ─── Container ──────────────────────────────────────────────────────────── */

#gbpdv-container {
    max-width: 840px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--gbpdv-text);
    line-height: 1.5;
}

/* ─── Form ───────────────────────────────────────────────────────────────── */

.gbpdv-form-wrapper {
    background: var(--gbpdv-white);
    border: 1px solid var(--gbpdv-border);
    border-radius: var(--gbpdv-radius);
    padding: 28px 32px;
    box-shadow: var(--gbpdv-shadow);
}

.gbpdv-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gbpdv-navy);
    margin: 0 0 6px 0;
}

.gbpdv-description {
    font-size: 0.95rem;
    color: var(--gbpdv-text-secondary);
    margin: 0 0 20px 0;
}

.gbpdv-input-row {
    display: flex;
    gap: 10px;
}

#gbpdv-url-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 0.95rem;
    border: 2px solid var(--gbpdv-border);
    border-radius: var(--gbpdv-radius);
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

#gbpdv-url-input:focus {
    border-color: var(--gbpdv-green-solid);
}

#gbpdv-submit-btn {
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gbpdv-white);
    background: var(--gbpdv-green);
    border: none;
    border-radius: var(--gbpdv-radius);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
    font-family: inherit;
}

#gbpdv-submit-btn:hover {
    background: var(--gbpdv-green-hover);
}

#gbpdv-submit-btn:active {
    transform: scale(0.98);
}

#gbpdv-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.gbpdv-turnstile-row {
    margin-top: 10px;
}

/* ─── Error ──────────────────────────────────────────────────────────────── */

.gbpdv-error {
    margin-top: 14px;
    padding: 12px 16px;
    background: var(--gbpdv-error-bg);
    border: 1px solid var(--gbpdv-error);
    border-radius: var(--gbpdv-radius);
    color: var(--gbpdv-error);
    font-size: 0.9rem;
}

/* ─── Loading ────────────────────────────────────────────────────────────── */

.gbpdv-loading {
    text-align: center;
    padding: 40px 20px;
}

.gbpdv-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--gbpdv-border);
    border-top-color: var(--gbpdv-green-solid);
    border-radius: 50%;
    animation: gbpdv-spin 0.8s linear infinite;
}

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

.gbpdv-loading-text {
    margin-top: 12px;
    font-size: 0.95rem;
    color: var(--gbpdv-text-secondary);
    animation: gbpdv-pulse 1.5s ease-in-out infinite;
}

@keyframes gbpdv-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ─── Results ────────────────────────────────────────────────────────────── */

.gbpdv-results {
    margin-top: 24px;
}

.gbpdv-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--gbpdv-navy);
    color: var(--gbpdv-white);
    border-radius: var(--gbpdv-radius) var(--gbpdv-radius) 0 0;
}

.gbpdv-results-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
}

.gbpdv-results-meta {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* ─── Section Groups ─────────────────────────────────────────────────────── */

.gbpdv-section {
    background: var(--gbpdv-white);
    border: 1px solid var(--gbpdv-border);
    border-top: none;
}

.gbpdv-section:last-child {
    border-radius: 0 0 var(--gbpdv-radius) var(--gbpdv-radius);
}

.gbpdv-section-title {
    padding: 10px 24px;
    background: var(--gbpdv-bg);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gbpdv-green-solid);
    border-bottom: 1px solid var(--gbpdv-border);
}

/* ─── Data Rows ──────────────────────────────────────────────────────────── */

.gbpdv-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.gbpdv-row {
    display: flex;
    align-items: flex-start;
    padding: 10px 24px;
    border-bottom: 1px solid #f0f1f3;
    min-height: 40px;
}

.gbpdv-row:last-child {
    border-bottom: none;
}

.gbpdv-row-full {
    grid-column: 1 / -1;
}

.gbpdv-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gbpdv-text-secondary);
    min-width: 120px;
    flex-shrink: 0;
}

.gbpdv-value {
    font-size: 0.92rem;
    color: var(--gbpdv-text);
    word-break: break-word;
    flex: 1;
}

.gbpdv-value a {
    color: var(--gbpdv-green-solid);
    text-decoration: none;
}

.gbpdv-value a:hover {
    text-decoration: underline;
}

.gbpdv-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-left: 6px;
    background: none;
    border: 1px solid var(--gbpdv-border);
    border-radius: 4px;
    cursor: pointer;
    color: var(--gbpdv-text-secondary);
    font-size: 0.7rem;
    transition: all 0.15s;
    vertical-align: middle;
    flex-shrink: 0;
}

.gbpdv-copy-btn:hover {
    background: var(--gbpdv-green-light);
    border-color: var(--gbpdv-green-solid);
    color: var(--gbpdv-green-solid);
}

.gbpdv-copy-btn.copied {
    background: var(--gbpdv-green-solid);
    border-color: var(--gbpdv-green-solid);
    color: white;
}

/* ─── Tooltip ────────────────────────────────────────────────────────────── */

.gbpdv-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--gbpdv-border);
    color: var(--gbpdv-text-secondary);
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 700;
    cursor: help;
    flex-shrink: 0;
    font-style: italic;
    font-family: Georgia, serif;
    line-height: 1;
}

.gbpdv-tooltip:hover::after {
    content: attr(data-tip);
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--gbpdv-navy);
    color: var(--gbpdv-white);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-style: normal;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 400;
    white-space: normal;
    width: 220px;
    line-height: 1.4;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    pointer-events: none;
}

.gbpdv-tooltip:hover::before {
    content: '';
    position: absolute;
    left: 19px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: var(--gbpdv-navy);
    z-index: 101;
    pointer-events: none;
}

/* ─── Categories ─────────────────────────────────────────────────────────── */

.gbpdv-category-tag {
    display: inline-block;
    padding: 3px 10px;
    background: var(--gbpdv-green-light);
    color: var(--gbpdv-green-solid);
    border-radius: 12px;
    font-size: 0.82rem;
    margin: 2px 4px 2px 0;
}

.gbpdv-category-tag.primary {
    background: var(--gbpdv-green);
    color: var(--gbpdv-white);
    font-weight: 600;
}

/* ─── Attributes ─────────────────────────────────────────────────────────── */

.gbpdv-attr-group-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gbpdv-navy);
    margin: 8px 0 4px 0;
}

.gbpdv-attr-group-title:first-child {
    margin-top: 0;
}

.gbpdv-attr-item {
    display: inline-block;
    padding: 2px 8px;
    background: var(--gbpdv-navy-light);
    color: var(--gbpdv-navy);
    border-radius: 10px;
    font-size: 0.78rem;
    margin: 2px 3px 2px 0;
}

/* ─── Stars ──────────────────────────────────────────────────────────────── */

.gbpdv-stars {
    color: #f4b400;
    font-size: 1rem;
    letter-spacing: 1px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1000px) {
    .gbpdv-grid {
        grid-template-columns: 1fr;
    }

    .gbpdv-form-wrapper {
        padding: 20px;
    }

    .gbpdv-input-row {
        flex-direction: column;
    }

    #gbpdv-submit-btn {
        width: 100%;
    }

    .gbpdv-row {
        padding: 10px 16px;
    }

    .gbpdv-section-title {
        padding: 10px 16px;
    }

    .gbpdv-results-header {
        padding: 14px 16px;
    }

    .gbpdv-tooltip:hover::after {
        left: auto;
        right: 0;
        top: 24px;
        transform: none;
        width: 200px;
    }

    .gbpdv-tooltip:hover::before {
        left: auto;
        right: 4px;
        top: 19px;
        transform: none;
        border: 5px solid transparent;
        border-bottom-color: var(--gbpdv-navy);
        border-right-color: transparent;
    }
}

/* ─── Rate Limit Banner ──────────────────────────────────────────────────── */

.gbpdv-rate-limit {
    margin-top: 16px;
    padding: 12px 20px;
    border-radius: var(--gbpdv-radius);
    font-size: 0.88rem;
    text-align: center;
}

.gbpdv-rate-limit a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.gbpdv-rate-info {
    background: var(--gbpdv-green-light);
    color: var(--gbpdv-green-solid);
    border: 1px solid var(--gbpdv-green-solid);
}

.gbpdv-rate-warn {
    background: #fff8e6;
    color: #8a6d00;
    border: 1px solid #d4a800;
}

/* ─── Report Flag ────────────────────────────────────────────────────────── */

.gbpdv-report-row {
    display: flex;
    justify-content: flex-end;
    padding: 8px 16px;
    background: var(--gbpdv-white);
    border: 1px solid var(--gbpdv-border);
    border-top: none;
    border-radius: 0 0 var(--gbpdv-radius) var(--gbpdv-radius);
}

.gbpdv-report-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.gbpdv-report-btn:hover {
    opacity: 1;
}

.gbpdv-flag-icon {
    font-size: 1.2rem;
    color: #cc7a7a;
}

/* ─── Report Modal ───────────────────────────────────────────────────────── */

.gbpdv-report-modal {
    margin-top: 12px;
}

.gbpdv-report-modal-content {
    background: var(--gbpdv-white);
    border: 1px solid var(--gbpdv-border);
    border-radius: var(--gbpdv-radius);
    padding: 20px 24px;
    box-shadow: var(--gbpdv-shadow);
}

.gbpdv-report-modal-content h4 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    color: var(--gbpdv-navy);
}

.gbpdv-report-desc {
    font-size: 0.85rem;
    color: var(--gbpdv-text-secondary);
    margin: 0 0 14px 0;
}

.gbpdv-report-field {
    margin-bottom: 12px;
}

.gbpdv-report-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gbpdv-text-secondary);
    margin-bottom: 4px;
}

.gbpdv-report-field input,
.gbpdv-report-field textarea {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.9rem;
    border: 1px solid var(--gbpdv-border);
    border-radius: 6px;
    font-family: inherit;
    box-sizing: border-box;
}

.gbpdv-report-field textarea {
    resize: vertical;
}

.gbpdv-report-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.gbpdv-report-submit-btn {
    padding: 8px 20px;
    background: var(--gbpdv-green);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.gbpdv-report-submit-btn:hover {
    background: var(--gbpdv-green-hover);
}

.gbpdv-report-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.gbpdv-report-cancel-btn {
    padding: 8px 20px;
    background: none;
    color: var(--gbpdv-text-secondary);
    border: 1px solid var(--gbpdv-border);
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
}

.gbpdv-report-cancel-btn:hover {
    background: var(--gbpdv-bg);
}
