/**
 * Stat Block Styles
 * 
 * Styles for the stat display block including:
 * - View mode (stat display in various styles)
 * - Edit mode (configuration wizard - reuses time-series wizard styles)
 */

/* ============================================================================
   BASE CONTAINER
   ============================================================================ */

.stat-block-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 0 !important;
    box-sizing: border-box;
}

/* ============================================================================
   PLACEHOLDER STATE
   ============================================================================ */

.stat-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--color-text-muted, #64748b);
    text-align: center;
    padding: 16px;
    box-sizing: border-box;
}

.stat-placeholder .placeholder-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    opacity: 0.6;
}

.stat-placeholder .placeholder-text {
    font-size: 0.875rem;
    font-style: italic;
}

/* ============================================================================
   VIEW MODE - STAT DISPLAY
   ============================================================================ */

.stat-view {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 16px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    
    /* Default accent color */
    --stat-accent-color: var(--color-primary, #6366f1);
}

/* Accent color variants */
.stat-view.accent-primary {
    --stat-accent-color: var(--color-primary, #6366f1);
}

.stat-view.accent-success {
    --stat-accent-color: #10b981;
}

.stat-view.accent-warning {
    --stat-accent-color: #f59e0b;
}

.stat-view.accent-danger {
    --stat-accent-color: #ef4444;
}

/* ============================================================================
   STAT HEADER
   ============================================================================ */

.stat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.stat-entity-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--stat-accent-color);
    flex-shrink: 0;
}

.stat-entity-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-entity-name {
    font-size: clamp(0.8rem, 2.2vw, 0.95rem);
    font-weight: 600;
    color: var(--color-text-primary, #f1f5f9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-entity-meta {
    font-size: clamp(0.65rem, 1.8vw, 0.75rem);
    color: var(--color-text-muted, #94a3b8);
}

/* ============================================================================
   STAT VALUE CONTAINER
   ============================================================================ */

.stat-value-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 0;
}

.stat-value {
    position: relative;
}

.stat-value .stat-loading {
    font-size: 1rem;
    color: var(--color-text-muted);
    animation: pulse 1.5s ease-in-out infinite;
}

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

.stat-value .stat-number {
    font-family: var(--font-mono, 'SF Mono', 'Fira Code', monospace);
    font-weight: 700;
    color: var(--stat-accent-color);
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-value .stat-error {
    font-size: 2rem;
    color: var(--color-text-muted);
}

.stat-label {
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    font-weight: 500;
    color: var(--color-text-primary, #f1f5f9);
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-aggregation {
    font-size: clamp(0.6rem, 1.5vw, 0.7rem);
    color: var(--color-text-muted, #94a3b8);
    margin-top: 4px;
}

/* ============================================================================
   DISPLAY STYLE: LARGE (Hero)
   ============================================================================ */

.stat-style-large .stat-value .stat-number {
    font-size: clamp(2.5rem, 10vw, 4rem);
}

.stat-style-large .stat-header {
    margin-bottom: 8px;
}

.stat-style-large .stat-entity-avatar {
    width: 42px;
    height: 42px;
}

/* ============================================================================
   DISPLAY STYLE: COMPACT
   ============================================================================ */

.stat-style-compact {
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
}

.stat-style-compact .stat-header {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

.stat-style-compact .stat-entity-avatar {
    width: 32px;
    height: 32px;
}

.stat-style-compact .stat-value-container {
    flex: 0 0 auto;
    align-items: flex-end;
}

.stat-style-compact .stat-value .stat-number {
    font-size: clamp(1.5rem, 5vw, 2rem);
}

.stat-style-compact .stat-label {
    font-size: 0.65rem;
    margin-top: 2px;
}

.stat-style-compact .stat-aggregation {
    display: none;
}

/* ============================================================================
   DISPLAY STYLE: CARD
   ============================================================================ */

.stat-style-card {
    padding: 12px;
    background: linear-gradient(135deg, 
        rgba(var(--color-primary-rgb), 0.1) 0%, 
        rgba(var(--color-primary-rgb), 0.05) 100%);
    border: 1px solid rgba(var(--color-primary-rgb), 0.2);
    border-radius: 12px;
}

.stat-style-card .stat-header {
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
}

.stat-style-card .stat-value .stat-number {
    font-size: clamp(1.8rem, 7vw, 2.5rem);
}

/* Card accent glow effect */
.stat-style-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--stat-accent-color) 50%, 
        transparent 100%);
    border-radius: 12px 12px 0 0;
}

/* ============================================================================
   EDIT MODE - WIZARD (extends time-series wizard styles)
   ============================================================================ */

.stat-editor {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 12px;
    box-sizing: border-box;
    overflow-y: auto;
}

/* Color option picker for config step */
.color-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-option {
    all: unset;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: white;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.color-option.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.875rem;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.color-option.color-primary {
    background: var(--color-primary, #6366f1);
}

.color-option.color-success {
    background: #10b981;
}

.color-option.color-warning {
    background: #f59e0b;
}

.color-option.color-danger {
    background: #ef4444;
}

/* ============================================================================
   SCROLLBAR STYLING (match time-series)
   ============================================================================ */

.stat-editor::-webkit-scrollbar {
    width: 4px;
}

.stat-editor::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.stat-editor::-webkit-scrollbar-thumb {
    background: rgba(var(--color-primary-rgb), 0.3);
    border-radius: 2px;
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 480px) {
    .stat-style-large .stat-value .stat-number {
        font-size: 2.5rem;
    }
    
    .stat-style-card .stat-value .stat-number {
        font-size: 2rem;
    }
    
    .stat-style-compact {
        flex-direction: column;
        align-items: stretch;
    }
    
    .stat-style-compact .stat-value-container {
        align-items: center;
        margin-top: 8px;
    }
}

