/* ============================================
   BLOCK CARDS - Material Design 3
   Clean Technical Data Display
   ============================================ */

.block-card {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-md);
    margin-bottom: 12px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.block-card.active {
    border-color: var(--md-sys-color-primary);
}

.block-card.complete {
    border-color: var(--md-sys-color-success);
}

.block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--md-sys-color-surface-variant);
    border-bottom: 1px solid var(--md-sys-color-outline);
}

.block-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.block-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-radius: var(--md-sys-shape-corner-sm);
    font-size: 13px;
    font-weight: 600;
}

.block-title h3 {
    font-size: 13px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    letter-spacing: 0;
}

.block-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 11px;
    font-weight: 500;
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-on-surface-variant);
}

.block-status .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--md-sys-color-outline);
}

.block-status.processing {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-primary);
}

.block-status.processing .status-dot {
    background: var(--md-sys-color-primary);
    animation: pulse 1.5s ease-in-out infinite;
}

.block-status.complete {
    background: var(--md-sys-color-success-container);
    border-color: var(--md-sys-color-success);
    color: var(--md-sys-color-success);
}

.block-status.complete .status-dot {
    background: var(--md-sys-color-success);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.block-content {
    padding: 16px;
}

/* ============================================
   PHYSICS DATA GRID - Clean Technical Display
   ============================================ */
.physics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.physics-card {
    background: var(--md-sys-color-surface-variant);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-md);
    padding: 12px;
}

.physics-label {
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 6px;
    font-weight: 500;
}

.physics-value {
    font-family: var(--md-sys-typescale-mono);
    font-size: 20px;
    font-weight: 600;
    color: var(--md-sys-color-primary);
}

.physics-bar {
    height: 4px;
    background: var(--md-sys-color-outline);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.physics-bar-fill {
    height: 100%;
    background: var(--md-sys-color-primary);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.vector-display {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.vector-component {
    font-family: var(--md-sys-typescale-mono);
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

.vector-component span {
    color: var(--md-sys-color-primary);
    font-weight: 500;
}

#vectorCanvas {
    width: 100%;
    height: 60px;
    border-radius: var(--md-sys-shape-corner-sm);
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
}

.kelvin-display {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.kelvin-value {
    font-family: var(--md-sys-typescale-mono);
    font-size: 20px;
    font-weight: 600;
    color: var(--md-sys-color-warning);
}

.kelvin-unit {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
}

.kelvin-gradient {
    height: 6px;
    margin-top: 10px;
    border-radius: 3px;
    background: linear-gradient(90deg, #FF8A65, #FFF59D, #81D4FA);
    position: relative;
}

.kelvin-marker {
    position: absolute;
    top: -3px;
    width: 4px;
    height: 12px;
    background: var(--md-sys-color-on-surface);
    border-radius: 2px;
    transition: left 0.4s ease;
}

.shadow-preview {
    width: 48px;
    height: 48px;
    margin: 8px auto 0;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    position: relative;
}

.shadow-preview::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 10px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    filter: blur(4px);
}

/* ============================================
   JSON OUTPUT - Monospace Code Block
   ============================================ */
.json-output {
    background: var(--md-sys-color-surface-variant);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-md);
    overflow: hidden;
}

.json-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--md-sys-color-surface);
    border-bottom: 1px solid var(--md-sys-color-outline);
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
}

.btn-copy {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
    color: var(--md-sys-color-primary);
    font-size: 11px;
    cursor: pointer;
    font-family: var(--md-sys-typescale-body);
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-copy:hover {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
}

.json-output pre {
    padding: 12px;
    margin: 0;
    font-family: var(--md-sys-typescale-mono);
    font-size: 11px;
    color: var(--md-sys-color-on-surface);
    overflow-x: auto;
    max-height: 100px;
    line-height: 1.5;
    background: var(--md-sys-color-surface-variant);
}

/* ============================================
   SEGMENT TABS - MD3 Tabs
   ============================================ */
.segment-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: var(--md-sys-color-surface-variant);
    padding: 4px;
    border-radius: var(--md-sys-shape-corner-md);
}

.segment-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: var(--md-sys-shape-corner-sm);
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: var(--md-sys-typescale-body);
    font-size: 12px;
    font-weight: 500;
}

.segment-tab:hover {
    background: var(--md-sys-color-surface);
}

.segment-tab.active {
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-primary);
    box-shadow: var(--md-sys-elevation-1);
}

.segment-letter {
    font-weight: 600;
    font-size: 14px;
}

.segment-name {
    font-size: 11px;
}

.segment-panel {
    display: none;
}

.segment-panel.active {
    display: block;
}

.segment-description {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.segment-tag {
    padding: 4px 8px;
    background: var(--md-sys-color-surface-variant);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
    font-size: 10px;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
}

/* Prompt Header with Copy Button */
.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.prompt-header label {
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
    margin: 0;
}

.btn-copy-prompt {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
    color: var(--md-sys-color-primary);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-copy-prompt:hover {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
}

.btn-copy-prompt span {
    font-size: 11px;
}

.prompt-output label {
    display: block;
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 6px;
    font-weight: 500;
}

.prompt-text {
    padding: 12px;
    background: var(--md-sys-color-surface-variant);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-md);
    font-size: 12px;
    color: var(--md-sys-color-on-surface);
    line-height: 1.6;
    min-height: 72px;
}

/* ============================================
   REFINEMENT SECTION
   ============================================ */
.refinement-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.mask-preview {
    background: var(--md-sys-color-surface-variant);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-md);
    padding: 12px;
    text-align: center;
}

#maskCanvas {
    width: 100%;
    max-height: 120px;
    border-radius: var(--md-sys-shape-corner-sm);
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
}

.mask-coordinates {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
    font-family: var(--md-sys-typescale-mono);
    font-size: 10px;
    color: var(--md-sys-color-on-surface-variant);
}

.mask-coordinates span span {
    color: var(--md-sys-color-primary);
    font-weight: 500;
}

.edit-instructions h4,
.quality-audit h4 {
    font-size: 12px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 10px;
}

.instruction-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--md-sys-color-surface-variant);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
}

.instruction-icon {
    font-size: 12px;
}

.instruction-item.complete .instruction-icon {
    color: var(--md-sys-color-success);
}

.quality-audit {
    background: var(--md-sys-color-surface-variant);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-md);
    padding: 12px;
}

.audit-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.audit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-sm);
    font-size: 11px;
}

.audit-label {
    color: var(--md-sys-color-on-surface-variant);
}

.audit-status {
    font-weight: 500;
}

.audit-status.pending {
    color: var(--md-sys-color-on-surface-variant);
}

.audit-status.pass {
    color: var(--md-sys-color-success);
}

.audit-status.warning {
    color: var(--md-sys-color-warning);
}

.audit-status.verified {
    color: #1A73E8;
    font-weight: 600;
}

.audit-status.checking {
    color: #F9AB00;
    font-weight: 500;
    animation: pulse-check 0.8s ease-in-out infinite;
}

@keyframes pulse-check {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Typing Indicator for Live Inference */
.typing-indicator {
    color: var(--md-sys-color-on-surface-variant);
    font-style: italic;
}

.typing-indicator .dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

/* Synthesizing Indicator */
.synthesizing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #1A73E8;
    font-weight: 500;
}

.synthesizing-indicator .dots::after {
    content: '';
    animation: dots 1s steps(4, end) infinite;
}

@keyframes dots {

    0%,
    20% {
        content: '';
    }

    40% {
        content: '.';
    }

    60% {
        content: '..';
    }

    80%,
    100% {
        content: '...';
    }
}

.prompt-text.loading {
    background: linear-gradient(90deg,
            var(--md-sys-color-surface-variant) 25%,
            var(--md-sys-color-surface) 50%,
            var(--md-sys-color-surface-variant) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

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

    100% {
        background-position: -200% 0;
    }
}

/* Block Active States - Google Blue */
.block-card.active {
    border-color: #1A73E8;
    box-shadow: 0 0 0 1px #1A73E8;
}

.block-card.complete {
    border-color: #1E8E3E;
}

/* Segment Tab Active Synthesizing State */
.segment-tab.active .segment-name {
    color: #1A73E8;
}

/* Instruction Item Animation */
.instruction-item {
    transition: all 0.25s ease-out;
}