/**
 * InsightFlow Extension Styles
 * 
 * Design Philosophy:
 * - Clean, professional appearance for enterprise environments
 * - Accessible color contrast ratios (WCAG AA compliant)
 * - Responsive layout adapts to different Tableau dashboard sizes
 * - Consistent spacing and typography for readability
 * - Visual hierarchy guides user attention to important insights
 */

/* Reset and base styles - ensures consistent rendering across browsers */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* System font stack for native OS appearance and fast rendering */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f7fa;
    color: #2c3e50;
    line-height: 1.6;
}

/* Container - centers content and provides consistent padding */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header - extension branding and context */
header {
    background-color: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

header h1 {
    color: #1a73e8;
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 4px;
}

.subtitle {
    color: #5f6368;
    font-size: 14px;
}

.info-note {
    color: #5f6368;
    font-size: 12px;
    font-style: italic;
    margin-top: 8px;
}

/* Card sections */
.card {
    background-color: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #202124;
}

.section-description {
    color: #5f6368;
    font-size: 13px;
    margin-bottom: 16px;
}

/* Info box - connection status with visual indicators */
.info-box {
    background-color: #f8f9fa;
    padding: 12px 16px;
    border-radius: 4px;
    /* Blue left border indicates loading/neutral state */
    border-left: 4px solid #1a73e8;
}

#connection-message {
    font-size: 14px;
    color: #202124;
}

/* Connection status indicators - provide immediate visual feedback */
.status-connected {
    border-left-color: #34a853 !important; /* Green for successful connection */
}

.status-error {
    border-left-color: #ea4335 !important; /* Red for errors */
}

/* Metrics - responsive grid layout adapts to container width */
.metrics-container {
    display: grid;
    /* Auto-fit creates as many columns as can fit, min 250px each */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.metric-card {
    background-color: #f8f9fa;
    padding: 16px;
    border-radius: 6px;
    border: 1px solid #e8eaed;
}

.metric-name {
    font-size: 13px;
    color: #5f6368;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 24px;
    font-weight: 600;
    color: #202124;
    margin-bottom: 4px;
}

.metric-change {
    font-size: 12px;
    font-weight: 500;
}

/* Metric change indicators - color signals positive/negative trends */
.metric-change.positive {
    color: #34a853; /* Green for positive changes */
}

.metric-change.negative {
    color: #ea4335; /* Red for negative changes */
}

.metric-change.neutral {
    color: #5f6368; /* Gray for minimal/no change */
}

/* Insights */
.insights-container {
    margin-bottom: 16px;
}

.insight-item {
    background-color: #f8f9fa;
    padding: 16px;
    border-radius: 6px;
    border-left: 4px solid #fbbc04;
    margin-bottom: 12px;
}

/* Insight severity indicators - left border color signals urgency */
.insight-item.severity-high {
    border-left-color: #ea4335; /* Red for critical issues */
}

.insight-item.severity-medium {
    border-left-color: #fbbc04; /* Yellow for warnings */
}

.insight-item.severity-low {
    border-left-color: #1a73e8; /* Blue for informational */
}

.insight-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.insight-title {
    font-size: 14px;
    font-weight: 600;
    color: #202124;
}

.insight-timestamp {
    font-size: 12px;
    color: #5f6368;
}

.insight-description {
    font-size: 13px;
    color: #5f6368;
    margin-bottom: 12px;
    line-height: 1.5;
}

.insight-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #1a73e8;
    color: #fff;
}

.btn-primary:hover {
    background-color: #1557b0;
}

.btn-secondary {
    background-color: #fff;
    color: #1a73e8;
    border: 1px solid #dadce0;
}

.btn-secondary:hover {
    background-color: #f8f9fa;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

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

/* Actions */
.actions-container {
    max-height: 300px;
    overflow-y: auto;
}

.action-item {
    background-color: #f8f9fa;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.action-info {
    flex: 1;
}

.action-title {
    font-size: 13px;
    color: #202124;
    margin-bottom: 4px;
}

.action-meta {
    font-size: 12px;
    color: #5f6368;
}

.action-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.status-completed {
    background-color: #e6f4ea;
    color: #137333;
}

.status-pending {
    background-color: #fef7e0;
    color: #7f5f01;
}

.status-assigned {
    background-color: #e8f0fe;
    color: #185abc;
}

/* Footer */
footer {
    text-align: center;
    padding: 16px;
    margin-top: 20px;
}

.footer-text {
    font-size: 12px;
    color: #5f6368;
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: #5f6368;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.empty-state-text {
    font-size: 14px;
}

/* Loading indicator */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #1a73e8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
