/**
 * Repivot Analytics Sidebar Styles
 * Premium design system — consistent spacing, color palette, typography.
 */

/* ========================================
   Base & Layout
   ======================================== */

.repivot-sidebar-analytics {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    font-size: 13px;
    color: #1e293b;
    line-height: 1.5;
}

/* ========================================
   Loading Skeleton
   ======================================== */

.repivot-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0;
}

.repivot-skeleton-bar {
    height: 16px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: repivot-shimmer 1.5s ease-in-out infinite;
}

@keyframes repivot-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   Error Messages
   ======================================== */

.repivot-error {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.repivot-error--upgrade {
    background: #fffbeb;
    border-color: #fde68a;
}

.repivot-error--connect {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.repivot-error-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.repivot-error-body strong {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

.repivot-error-body p {
    margin: 0 0 8px;
    font-size: 12px;
    color: #64748b;
}

.repivot-error-action {
    font-size: 12px;
    font-weight: 600;
    color: #10B981;
    text-decoration: none;
}

.repivot-error-action:hover {
    text-decoration: underline;
}

/* ========================================
   Metrics Grid
   ======================================== */

.repivot-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

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

.repivot-metric-card {
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.repivot-metric-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
}

.repivot-metric-value {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.repivot-metric-delta {
    font-size: 11px;
    font-weight: 600;
}

.repivot-delta--positive {
    color: #22c55e;
}

.repivot-delta--negative {
    color: #ef4444;
}

/* ========================================
   Analytics Tab
   ======================================== */

.repivot-analytics-signal {
    margin-bottom: 12px;
}

.repivot-analytics-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.repivot-section-subtitle {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.repivot-mini-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.repivot-mini-list li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 12px;
}

.repivot-mini-list li:last-child {
    border-bottom: none;
}

.repivot-mini-label {
    color: #475569;
}

.repivot-mini-value {
    font-weight: 600;
    color: #0f172a;
}

.repivot-view-full-link {
    display: block;
    margin-top: 16px;
    font-size: 12px;
    font-weight: 600;
    color: #10B981;
    text-decoration: none;
    text-align: center;
}

.repivot-view-full-link:hover {
    text-decoration: underline;
}

/* ========================================
   Queries Tab
   ======================================== */

.repivot-query-card {
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 10px;
}

.repivot-query-card:last-child {
    margin-bottom: 0;
}

.repivot-query-card__term {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
    word-wrap: break-word;
    margin-bottom: 10px;
}

.repivot-query-card__metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.repivot-query-card__metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.repivot-query-card__label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
}

.repivot-query-card__value {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.repivot-position--good { color: #22c55e !important; font-weight: 600; }
.repivot-position--mid  { color: #f59e0b !important; font-weight: 600; }
.repivot-position--low  { color: #ef4444 !important; font-weight: 600; }

/* ========================================
   Empty Tab State
   ======================================== */

.repivot-empty-tab {
    text-align: center;
    padding: 32px 16px;
    color: #64748b;
}

.repivot-empty-tab p {
    margin: 0 0 12px;
    font-size: 13px;
}

/* ========================================
   Signal Badges (shared)
   ======================================== */

.repivot-signal-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.repivot-signal-badge:hover {
    opacity: 0.85;
    text-decoration: none;
}

.repivot-signal-badge--blue   { background: #dbeafe; color: #1e40af; }
.repivot-signal-badge--red    { background: #fee2e2; color: #991b1b; }
.repivot-signal-badge--orange { background: #ffedd5; color: #9a3412; }
.repivot-signal-badge--gray   { background: #f3f4f6; color: #374151; }
.repivot-signal-badge--yellow { background: #fef3c7; color: #92400e; }
