/* Datasculpt Inspector Custom Styles */

/* ============================================
   Design Tokens
   ============================================ */
:root {
    /* Background colors */
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-elevated: #2a2a3e;
    --bg-hover: #3a3a4e;
    --bg-overlay: rgba(0, 0, 0, 0.85);

    /* Text colors */
    --text-primary: #f5f5f5;
    --text-secondary: #b5b5b5;
    --text-muted: #7a7a7a;
    --text-dark: #363636;

    /* Border colors */
    --border-default: #4a4a4a;
    --border-muted: #363636;

    /* Accent colors */
    --accent-primary: #00d1b2;
    --accent-primary-rgb: 0, 209, 178;
    --accent-blue: #3273dc;
    --accent-blue-rgb: 50, 115, 220;

    /* Role colors */
    --role-key: #f14668;
    --role-dimension: #3273dc;
    --role-measure: #48c78e;
    --role-time: #ffe08a;
    --role-indicator: #b86bff;
    --role-value: #00d1b2;
    --role-series: #ff9d1c;
    --role-metadata: #7a7a7a;

    /* Status colors */
    --status-success: #00d1b2;
    --status-warning: #ffe08a;
    --status-danger: #f14668;

    /* Shadows */
    --shadow-glow: 0 0 20px rgba(var(--accent-primary-rgb), 0.3);
    --shadow-hover: 0 4px 16px rgba(var(--accent-primary-rgb), 0.15);
    --shadow-dragover: 0 0 30px rgba(var(--accent-primary-rgb), 0.2);

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-pill: 20px;

    /* Spacing */
    --bar-height: 8px;
}

/* ============================================
   Bulma Overrides (Dark Mode)
   ============================================ */
.box {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.footer {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
}

/* ============================================
   Loading Overlay
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.is-active {
    display: flex;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-default);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.loading-status {
    font-size: 1.25rem;
    color: var(--text-primary);
}

/* ============================================
   Processing Section
   ============================================ */
.processing-box {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
}

.processing-spinner {
    width: 80px;
    height: 80px;
    border: 5px solid var(--border-muted);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

.processing-status {
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 500;
}

.processing-substatus {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ============================================
   Upload Zone
   ============================================ */
.upload-zone {
    border: 3px dashed var(--border-default);
    transition: all var(--transition-normal);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-primary);
}

.upload-zone:hover,
.upload-zone.is-dragover {
    border-color: var(--accent-primary);
    background-color: var(--bg-secondary);
}

.upload-zone.is-dragover {
    transform: scale(1.02);
    box-shadow: var(--shadow-dragover);
}

/* ============================================
   Role Color Badges
   ============================================ */
.role-badge {
    display: inline-block;
    padding: 0.25em 0.75em;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-key {
    background-color: var(--role-key);
    color: white;
}

.role-dimension {
    background-color: var(--role-dimension);
    color: white;
}

.role-measure {
    background-color: var(--role-measure);
    color: white;
}

.role-time {
    background-color: var(--role-time);
    color: var(--text-dark);
}

.role-indicator_name {
    background-color: var(--role-indicator);
    color: white;
}

.role-value {
    background-color: var(--role-value);
    color: white;
}

.role-series {
    background-color: var(--role-series);
    color: white;
}

.role-metadata {
    background-color: var(--role-metadata);
    color: white;
}

.role-unknown {
    background-color: var(--text-secondary);
    color: var(--text-dark);
}

/* ============================================
   Shape Hypothesis Cards
   ============================================ */
.shape-card {
    border: 2px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: all var(--transition-fast);
    height: 100%;
    background-color: var(--bg-primary);
}

.shape-card.is-winner {
    border-color: var(--accent-primary);
    border-width: 3px;
    box-shadow: var(--shadow-glow);
}

.shape-card .shape-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.shape-card.is-winner .shape-name {
    color: var(--accent-primary);
}

.shape-card .shape-score {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.shape-card.is-winner .shape-score {
    color: var(--accent-primary);
}

.shape-card .shape-description {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ============================================
   Score Bar
   ============================================ */
.score-bar {
    height: var(--bar-height);
    background-color: var(--border-muted);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 0.5rem;
}

.score-bar-fill {
    height: 100%;
    background-color: var(--accent-blue);
    transition: width var(--transition-normal);
}

.shape-card.is-winner .score-bar-fill {
    background-color: var(--accent-primary);
}

/* ============================================
   Column Cards
   ============================================ */
.column-card {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 1rem;
    height: 100%;
    transition: all var(--transition-fast);
    background-color: var(--bg-primary);
}

.column-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--accent-primary);
}

.column-card .column-name {
    font-weight: 600;
    font-family: monospace;
    font-size: 0.95rem;
    word-break: break-all;
    color: var(--text-primary);
}

.column-card .column-type {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.column-card .column-stats {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ============================================
   Grain Display
   ============================================ */
.grain-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.grain-column {
    background-color: var(--role-key);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    font-family: monospace;
    font-weight: 500;
}

.grain-confidence {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.grain-uniqueness {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   Question Cards
   ============================================ */
.question-card {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1rem;
    background-color: var(--bg-primary);
}

.question-text {
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.question-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.choice-button {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-default);
    border-radius: var(--radius-pill);
    background: var(--bg-elevated);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.choice-button:hover {
    border-color: var(--accent-primary);
    background-color: var(--bg-hover);
}

.choice-button.is-selected {
    border-color: var(--accent-primary);
    background-color: var(--accent-primary);
    color: var(--bg-primary);
}

/* ============================================
   Diagnostics
   ============================================ */
.diagnostic-item {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.diagnostic-item.is-warning {
    background-color: rgba(255, 224, 138, 0.15);
    border-left: 4px solid var(--status-warning);
}

.diagnostic-item.is-info {
    background-color: rgba(var(--accent-blue-rgb), 0.15);
    border-left: 4px solid var(--accent-blue);
}

.diagnostic-item.is-success {
    background-color: rgba(var(--accent-primary-rgb), 0.15);
    border-left: 4px solid var(--status-success);
}

/* ============================================
   Confidence Meter
   ============================================ */
.confidence-meter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.confidence-bar {
    flex: 1;
    height: var(--bar-height);
    background-color: var(--border-muted);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    transition: width var(--transition-normal);
}

.confidence-fill.is-low {
    background-color: var(--status-danger);
}

.confidence-fill.is-medium {
    background-color: var(--status-warning);
}

.confidence-fill.is-high {
    background-color: var(--status-success);
}

.confidence-value {
    font-weight: 600;
    min-width: 50px;
    text-align: right;
    color: var(--text-primary);
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media screen and (max-width: 768px) {
    .upload-zone {
        min-height: 150px;
    }

    .shape-card {
        margin-bottom: 1rem;
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.is-hidden {
    display: none !important;
}

/* ============================================
   Alternative Roles Dropdown
   ============================================ */
.alternatives-dropdown {
    margin-top: 0.5rem;
}

.alternatives-dropdown select {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    cursor: pointer;
}

.alternatives-dropdown select:focus {
    border-color: var(--accent-primary);
    outline: none;
}
