/**
 * AROPS-1 Component Styles
 */

/* Base component styles */
.airops-component {
    background: var(--bg-secondary, #1a1a2e);
    border: 1px solid var(--border-color, #333);
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
}

.airops-component-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #fff);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color, #333);
}

/* Response container */
.airops-response {
    font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
}

.airops-summary {
    margin-bottom: 16px;
}

.airops-summary ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.airops-summary li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    color: var(--text-secondary, #ccc);
    line-height: 1.5;
}

.airops-summary li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent-primary, #3b82f6);
}

/* Data tables */
.airops-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.airops-data-table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg-tertiary, #252538);
    color: var(--text-secondary, #999);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color, #333);
}

.airops-data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color-light, #2a2a3e);
    color: var(--text-primary, #e0e0e0);
}

.airops-data-table tr:hover td {
    background: var(--bg-hover, rgba(59, 130, 246, 0.1));
}

.airops-data-table a {
    color: var(--accent-primary, #3b82f6);
    text-decoration: none;
}

.airops-data-table a:hover {
    text-decoration: underline;
}

.airops-highlight {
    background: rgba(245, 158, 11, 0.15);
    font-weight: 500;
}

/* Chart placeholder */
.airops-chart-placeholder {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-tertiary, #252538);
    border-radius: 4px;
    color: var(--text-secondary, #999);
}

.airops-chart-info {
    font-size: 12px;
    margin-top: 8px;
    color: var(--text-tertiary, #666);
}

/* SERP table features */
.airops-serp-features {
    font-size: 12px;
    color: var(--text-secondary, #999);
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--bg-tertiary, #252538);
    border-radius: 4px;
}

/* Topical map */
.airops-topics-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.airops-topic-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary, #252538);
    border-radius: 16px;
    font-size: 12px;
}

.airops-topic-name {
    color: var(--text-primary, #e0e0e0);
}

.airops-topic-freq {
    color: var(--accent-primary, #3b82f6);
    font-weight: 500;
}

/* Content audit */
.airops-audit-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.airops-audit-score {
    text-align: center;
    padding: 12px 20px;
    border-radius: 8px;
    min-width: 80px;
}

.airops-score-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
}

.airops-score-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.airops-score-good {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.airops-score-medium {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.airops-score-poor {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.airops-audit-url {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary, #999);
}

.airops-audit-sections {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.airops-audit-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-tertiary, #252538);
    border-radius: 4px;
    font-size: 12px;
}

.airops-section-name {
    color: var(--text-secondary, #999);
}

.airops-section-score {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.airops-audit-actions h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #999);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.airops-audit-actions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.airops-audit-actions li {
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
    font-size: 13px;
    color: var(--text-primary, #e0e0e0);
}

.airops-audit-actions li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent-primary, #3b82f6);
}

/* Action grid */
.airops-action-grid-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.airops-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s;
}

.airops-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.airops-btn-primary {
    background: var(--accent-primary, #3b82f6);
    color: white;
}

.airops-btn-secondary {
    background: var(--bg-tertiary, #252538);
    color: var(--text-primary, #e0e0e0);
    border: 1px solid var(--border-color, #333);
}

/* Insights */
.airops-insight-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.airops-insight-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color-light, #2a2a3e);
}

.airops-insight-item:last-child {
    border-bottom: none;
}

.airops-insight-icon {
    font-size: 14px;
    line-height: 1.5;
}

.airops-insight-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary, #e0e0e0);
    line-height: 1.5;
}

.airops-insight-metric {
    font-size: 12px;
    color: var(--text-secondary, #999);
    background: var(--bg-tertiary, #252538);
    padding: 2px 8px;
    border-radius: 4px;
}

.airops-severity-high .airops-insight-text {
    color: #ef4444;
}

.airops-severity-medium .airops-insight-text {
    color: #f59e0b;
}

.airops-severity-low .airops-insight-text {
    color: #10b981;
}

/* Metric card */
.airops-metric-card {
    text-align: center;
    padding: 20px;
}

.airops-metric-label {
    font-size: 12px;
    color: var(--text-secondary, #999);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.airops-metric-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary, #fff);
}

.airops-metric-change {
    font-size: 13px;
    margin-top: 8px;
}

.airops-metric-change.positive {
    color: #10b981;
}

.airops-metric-change.negative {
    color: #ef4444;
}

.airops-metric-change.neutral {
    color: var(--text-secondary, #999);
}

/* Next actions */
.airops-next-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color, #333);
}

.airops-next-actions h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #999);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.airops-next-actions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.airops-next-actions li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    font-size: 13px;
    color: var(--text-primary, #e0e0e0);
}

.airops-next-actions li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent-primary, #3b82f6);
    font-weight: 600;
}

/* Data sources */
.airops-data-sources {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color-light, #2a2a3e);
    color: var(--text-tertiary, #666);
    font-size: 11px;
}

/* Unknown component fallback */
.airops-unknown {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.airops-unknown pre {
    font-size: 11px;
    overflow-x: auto;
    color: var(--text-secondary, #999);
}

/* =============================================================================
 * AEO Chart Shortcode Styles
 * Styles for [AEO:chart_type:query params] shortcodes
 * ============================================================================= */

/* Base chart container */
.aeo-chart-container {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    min-height: 200px;
}

/* Max width for bar and donut charts */
.aeo-chart-container.aeo-chart-bar,
.aeo-chart-container.aeo-chart-donut {
    max-width: 600px;
}

/* Chart title */
.aeo-chart-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

/* Inner chart container */
.aeo-chart-inner {
    position: relative;
    min-height: 180px;
}

.aeo-chart-inner canvas {
    max-width: 100%;
}

/* Loading state */
.aeo-chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.aeo-chart-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #666;
}

.aeo-chart-loading-icon {
    font-size: 24px;
    animation: aeo-pulse 1.5s ease-in-out infinite;
}

.aeo-chart-loading-text {
    font-size: 12px;
}

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

/* Shimmer skeleton effect for loading */
.aeo-chart-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    animation: aeo-shimmer 2s infinite;
}

@keyframes aeo-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Error state */
.aeo-chart-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.aeo-chart-error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 120px;
}

.aeo-chart-error-icon {
    font-size: 24px;
}

.aeo-chart-error-text {
    font-size: 12px;
    color: #666;
}

/* Leaderboard table styles */
.aeo-leaderboard {
    font-size: 13px;
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.aeo-leaderboard-rank-badge {
    display: inline-block;
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 12px;
}

.aeo-leaderboard-header {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px;
    padding: 10px 12px;
    background: #f5f5f5;
    background: var(--bg-tertiary, #252538);
    border-radius: 6px 6px 0 0;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    align-items: center;
}

.aeo-leaderboard-body {
    max-height: 400px;
    overflow-y: auto;
}

.aeo-leaderboard-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    transition: background 0.15s ease;
    align-items: center;
}

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

.aeo-leaderboard-row:hover {
    background: rgba(59, 130, 246, 0.05);
}

.aeo-leaderboard-row.highlight {
    background: rgba(59, 130, 246, 0.08);
}

.aeo-leaderboard-row.highlight:hover {
    background: rgba(59, 130, 246, 0.12);
}

.aeo-leaderboard-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
    padding: 4px 0;
    display: inline-block;
}

/* First cell (Question/URL) gets more space */
.aeo-leaderboard-cell:first-child {
    flex: 3;
    min-width: 200px;
}

/* Middle cells (Topic, Domain) */
.aeo-leaderboard-cell:nth-child(2) {
    flex: 1.5;
    min-width: 100px;
}

/* Numeric cells (Citations, Visibility, etc.) */
.aeo-leaderboard-cell:nth-child(n+3) {
    flex: 1;
    min-width: 80px;
    text-align: right;
}

.aeo-leaderboard-cell.rank {
    font-weight: 600;
    color: #666;
    flex: 0 0 40px;
    min-width: 40px;
    text-align: center;
}

/* Progress bar in leaderboard cells */
.aeo-leaderboard-bar-container {
    position: relative;
    display: flex;
    align-items: center;
    height: 20px;
}

.aeo-leaderboard-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.aeo-leaderboard-value {
    position: relative;
    z-index: 1;
    padding-left: 4px;
    font-weight: 500;
    color: #333;
}

/* Links in leaderboard */
.aeo-leaderboard-cell a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.15s ease;
}

.aeo-leaderboard-cell a:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* Sparkline container */
.aeo-spark {
    display: inline-block;
    vertical-align: middle;
}

/* Heatmap styles */
.aeo-heatmap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.aeo-heatmap-row {
    display: flex;
    gap: 2px;
}

.aeo-heatmap-row.header {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #999);
}

.aeo-heatmap-cell {
    flex: 1;
    min-width: 40px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    border-radius: 3px;
    transition: transform 0.15s ease;
}

.aeo-heatmap-cell:not(.label):hover {
    transform: scale(1.05);
    z-index: 1;
}

.aeo-heatmap-cell.label {
    background: transparent;
    color: var(--text-secondary, #999);
    font-size: 11px;
    justify-content: flex-end;
    padding-right: 8px;
    min-width: 100px;
    flex: 0 0 100px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .aeo-chart-container {
        padding: 12px;
        margin: 12px 0;
    }
    
    .aeo-leaderboard-header,
    .aeo-leaderboard-row {
        flex-wrap: wrap;
    }
    
    .aeo-leaderboard-cell:first-child {
        flex: 1 0 100%;
        margin-bottom: 4px;
    }
}

