/* ============================================
   GOOGLE SEO — GSC Search Analytics
   ============================================ */

/* --- Tool Fullscreen Mode --- */

/* Hides header + toolbar so the tool fills the viewport.
   Settings icons float over the tool panel header. */

/* Collapse header to zero height but keep it in flow for settings container */
body.tool-fullscreen .main-header {
    height: 0;
    min-height: 0;
    padding: 0;
    border: none;
    overflow: visible;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Hide logo + tabs */
body.tool-fullscreen .main-header .logo-container,
body.tool-fullscreen .main-header .main-tabs {
    display: none !important;
}

/* Float settings icons into the tool panel header row */
body.tool-fullscreen .header-settings-container {
    position: fixed;
    top: 22px;
    right: 48px;
    z-index: 200;
}

body.tool-fullscreen .tools-flip-toolbar {
    display: none !important;
}

/* Top margin matches sides/bottom for depth */
body.tool-fullscreen .tools-flip-back {
    margin-top: 0;
}

/* Hide description text on all fullscreen tools */
body.tool-fullscreen .tool-panel:not(.hidden) .tool-panel-overview {
    display: none !important;
}

/* Separate tool-panel-header from the workspace below */
body.tool-fullscreen .tool-panel:not(.hidden) .tool-panel-header {
    margin-bottom: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

body.tool-fullscreen .tool-panel:not(.hidden) {
    padding-top: 8px;
}

/* Hide Live badge, Open in Studio, Video btn, and agent label in fullscreen */
body.tool-fullscreen .tool-status-badge,
body.tool-fullscreen .open-in-studio-btn,
body.tool-fullscreen .tool-video-btn,
body.tool-fullscreen .tool-panel-agent {
    display: none !important;
}

/* Center the title: header becomes relative anchor, title is absolutely centered */
body.tool-fullscreen .tool-panel:not(.hidden) .tool-panel-header {
    position: relative;
    justify-content: flex-start;
}

body.tool-fullscreen .tool-panel-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

/* Button bar moves left (after back button) instead of far right */
body.tool-fullscreen .tool-panel-button-bar {
    margin-left: 8px;
}

/* --- SEO Hub fullscreen extras --- */

/* Hide the site-select / disconnect toolbar row */
body.tool-fullscreen .gseo-toolbar {
    display: none !important;
}

/* AI Brief: use full width */
body.tool-fullscreen .shub-brief {
    max-width: none;
}

/* Tab bar: flex layout so refresh button sits at far right */
body.tool-fullscreen .gseo-tab-bar {
    display: flex;
    align-items: stretch;
}

.gseo-tab-bar-spacer {
    flex: 1;
    border: none;
    border-left: 1px solid rgba(0, 0, 0, 0.12);
    background: transparent;
}


/* --- Loading State --- */
.gseo-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--color-text-secondary, #6b7280);
    font-size: 14px;
    gap: 10px;
}

.gseo-loading.hidden {
    display: none;
}

/* --- SEO Hub tab containers --- */
#seo-hub-recommendations.hidden,
#gseo-data-tab.hidden,
#gvr-container.hidden,
#seo-hub-trust-score.hidden,
#seo-hub-page-speed.hidden,
#seo-hub-competitors.hidden,
#seo-hub-topic-coverage.hidden {
    display: none;
}

/* --- Connect Card --- */
.gseo-connect-card {
    max-width: 420px;
    margin: 60px auto;
    text-align: center;
    padding: 40px 32px;
    background: white;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.gseo-connect-card.hidden {
    display: none;
}

.gseo-connect-icon {
    margin-bottom: 20px;
    color: var(--color-primary, #2563eb);
}

.gseo-connect-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text, #1a1a1a);
}

.gseo-connect-desc {
    font-size: 14px;
    color: var(--color-text-secondary, #6b7280);
    line-height: 1.5;
    margin-bottom: 24px;
}

.gseo-connect-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.gseo-connect-btn:hover {
    background: #3367d6;
}

.gseo-connect-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- Dashboard --- */
.gseo-dashboard {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 0;
}

.gseo-dashboard.hidden {
    display: none;
}

/* --- Tab Bar (7 tabs, horizontal scroll on small screens) --- */
.gseo-tab-bar {
    display: flex;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    margin-bottom: 16px;
}

.gseo-tab-bar::-webkit-scrollbar {
    display: none;
}

.gseo-tab-bar button {
    padding: 8px 14px;
    border: none;
    background: white;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary, #6b7280);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    white-space: nowrap;
}

.gseo-tab-bar button + button {
    border-left: 1px solid rgba(0, 0, 0, 0.12);
}

.gseo-tab-bar button:hover:not(.active) {
    background: var(--color-surface-alt, #f3f4f6);
}

.gseo-tab-bar button.active {
    background: var(--color-primary, #2563eb);
    color: white;
}

/* --- Tab Content --- */
#gseo-data-tab.hidden,
#gvr-container.hidden,
#seo-hub-ai-brief.hidden,
#seo-hub-trust-score.hidden,
#seo-hub-page-speed.hidden,
#seo-hub-competitors.hidden,
#seo-hub-topic-coverage.hidden {
    display: none;
}

/* --- Search Traffic sub-toolbar --- */
.gseo-search-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}


/* --- Toolbar (shared across all tabs) --- */
.gseo-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.gseo-site-select {
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    font-size: 13px;
    background: white;
    color: var(--color-text, #1a1a1a);
    min-width: 200px;
    max-width: 340px;
}

.gseo-date-range {
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    font-size: 13px;
    background: white;
    color: var(--color-text, #1a1a1a);
}

.gseo-view-toggle {
    display: inline-flex;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    overflow: hidden;
}

.gseo-view-toggle button {
    padding: 8px 16px;
    border: none;
    background: white;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary, #6b7280);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.gseo-view-toggle button + button {
    border-left: 1px solid rgba(0, 0, 0, 0.12);
}

.gseo-view-toggle button.active {
    background: var(--color-primary, #2563eb);
    color: white;
}

.gseo-toolbar-spacer {
    flex: 1;
}

.gseo-disconnect-btn {
    padding: 8px 14px;
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 8px;
    background: transparent;
    color: #dc2626;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.gseo-disconnect-btn:hover {
    background: rgba(220, 38, 38, 0.05);
}

/* --- Table --- */
.gseo-table-wrap {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
    background: white;
}

.gseo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.gseo-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary, #6b7280);
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.gseo-table tbody tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    transition: background 0.1s;
}

.gseo-table tbody tr:last-child {
    border-bottom: none;
}

.gseo-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.015);
}

.gseo-table td {
    padding: 10px 16px;
    color: var(--color-text, #1a1a1a);
}

.gseo-cell-key {
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.gseo-cell-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.gseo-table thead th:not(:first-child) {
    text-align: right;
}

.gseo-table-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--color-text-secondary, #6b7280);
}

.gseo-table-error {
    color: #dc2626;
}

/* --- Spinner --- */
.gseo-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--color-primary, #2563eb);
    border-radius: 50%;
    animation: gseo-spin 0.6s linear infinite;
    margin: 0 auto 8px;
}

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

/* ── Summary Cards (Search Traffic) ──── */

.gseo-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.gseo-summary-card {
    padding: 14px 12px;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 12px;
    text-align: center;
    background: var(--color-bg-secondary, #fff);
}

.gseo-summary-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted, #6b7280);
    margin-bottom: 4px;
}

.gseo-summary-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
}

.gseo-summary-desc {
    font-size: 11px;
    color: var(--color-text-muted, #9ca3af);
    margin: 6px 0 0;
    line-height: 1.4;
}

/* ── Keyword Distribution Bar ──── */

.gseo-kw-bar-wrap {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 12px;
    background: var(--color-bg-secondary, #fff);
}

.gseo-kw-bar-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted, #6b7280);
    margin-bottom: 8px;
}

.gseo-kw-bar {
    display: flex;
    height: 28px;
    border-radius: 8px;
    overflow: hidden;
    gap: 2px;
}

.gseo-kw-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    min-width: 24px;
    transition: width 0.3s ease;
}

.gseo-kw-top3 {
    background: #16a34a;
    border-radius: 8px 0 0 8px;
}

.gseo-kw-page1 {
    background: #22c55e;
}

.gseo-kw-rest {
    background: #d1d5db;
    color: #6b7280;
    border-radius: 0 8px 8px 0;
}

.gseo-kw-bar-legend {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.gseo-kw-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--color-text-muted, #6b7280);
    font-weight: 500;
}

.gseo-kw-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* ── Tab Description ──── */

.gseo-tab-desc {
    font-size: 12px;
    color: var(--color-text-muted, #6b7280);
    margin: 0 0 10px;
    line-height: 1.5;
    padding: 0 2px;
}

/* ── Opportunity Row ──── */

.gseo-row-opportunity {
    background: #fef3c710;
}

.gseo-opportunity-tag {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #d97706;
    background: #fef3c7;
    padding: 1px 6px;
    border-radius: 6px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ── Summary responsive ──── */

@media (width <= 900px) {
    .gseo-summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (width <= 640px) {
    .gseo-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gseo-summary-value {
        font-size: 22px;
    }
}
