/* NMR Simulator - Component Styles */

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-indicator.ready {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-indicator.running {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-indicator.running::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 1s ease-in-out infinite;
}

.status-indicator.error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Tooltip */
.tooltip-wrapper {
    position: relative;
    display: inline-block;
}

.tooltip-wrapper .tooltip-text {
    visibility: hidden;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    white-space: nowrap;
    box-shadow: 0 4px 12px var(--shadow);
    border: 1px solid var(--border-color);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tooltip-wrapper .tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--surface) transparent transparent transparent;
}

.tooltip-wrapper:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--surface-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Card Components */
.card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    transition: all 0.3s ease;
}

.card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px var(--glow-primary);
}

.card-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.card-body {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Data Display Grid */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.data-item {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
    text-align: center;
}

.data-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-light);
    font-family: 'Consolas', 'Monaco', monospace;
}

.data-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface-light);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider::before {
    position: absolute;
    content: '';
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--text-secondary);
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--primary-color);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(24px);
    background: white;
}

/* Pill Tabs */
.pill-tabs {
    display: flex;
    background: var(--surface-light);
    border-radius: 0.5rem;
    padding: 0.25rem;
    gap: 0.25rem;
}

.pill-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.pill-tab:hover {
    color: var(--text-primary);
}

.pill-tab.active {
    background: var(--primary-color);
    color: white;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.badge-primary {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
}

.badge.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* Loader */
.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--surface-lighter);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

.loader.loader-large {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

/* Number Input with Buttons */
.number-input {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.number-input input {
    width: 60px;
    text-align: center;
    padding: 0.375rem 0.5rem;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: 'Consolas', 'Monaco', monospace;
}

.number-input button {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.number-input button:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Divider */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: 1rem 0;
}

.divider-vertical {
    width: 1px;
    height: 100%;
    background: var(--border-color);
}

/* Icon Button */
.icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--glow-primary);
}

/* Collapsible Section */
.collapsible {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--surface-light);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.collapsible-header:hover {
    background: var(--surface-lighter);
}

.collapsible-icon {
    transition: transform 0.3s ease;
}

.collapsible.open .collapsible-icon {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible.open .collapsible-content {
    max-height: 500px;
}

.collapsible-body {
    padding: 1rem;
}

/* Range Input with Track Fill */
.range-filled {
    position: relative;
}

.range-filled input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--primary-color) 0%, var(--primary-color) var(--fill-percent, 50%), var(--surface-light) var(--fill-percent, 50%), var(--surface-light) 100%);
    cursor: pointer;
}

/* Notification Toast */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    max-width: 350px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 10px 30px var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    z-index: 2000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
}

.toast.toast-success {
    border-left: 3px solid var(--success);
}

.toast.toast-error {
    border-left: 3px solid var(--danger);
}

.toast.toast-warning {
    border-left: 3px solid var(--warning);
}

/* Spectral Peak Label */
.peak-label {
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    color: var(--text-primary);
    white-space: nowrap;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 10;
}

.peak-label::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--border-color);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state-description {
    font-size: 0.9rem;
    max-width: 300px;
}

/* Small Buttons */
.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
}

.spectrum-controls {
    position: absolute;
    bottom: 12px;
    left: 12px;
    display: flex;
    gap: 0.5rem;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
}

/* Peak Label Legend */
.peak-label-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(30, 41, 59, 0.95);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.peak-label-legend strong {
    color: var(--text-primary);
    font-size: 0.8rem;
}

.peak-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.peak-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 0.25rem;
    font-size: 0.7rem;
    color: var(--primary-light);
    font-family: 'Consolas', 'Monaco', monospace;
}

.peak-tag.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.peak-tag.clickable:hover {
    background: rgba(99, 102, 241, 0.4);
    border-color: rgba(99, 102, 241, 0.8);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

/* Bloch Sphere State Info */
.bloch-state-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(30, 41, 59, 0.8);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.state-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 0.375rem;
}

.state-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-light);
    font-family: 'Consolas', 'Monaco', monospace;
}

.state-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Bloch sphere panel controls */
.bloch-panel-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(30, 41, 59, 0.95);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.bloch-buttons-row {
    display: flex;
    gap: 0.35rem;
}

.bloch-buttons-row .btn {
    flex: 1;
    font-size: 0.7rem;
    padding: 0.35rem 0.5rem;
}

.bloch-custom-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.bloch-custom-row span {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.input-tiny {
    width: 45px;
    padding: 0.25rem 0.35rem;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    color: var(--text-primary);
    font-size: 0.75rem;
    text-align: center;
}

.select-tiny {
    padding: 0.25rem 0.35rem;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    color: var(--text-primary);
    font-size: 0.75rem;
    min-width: 40px;
}

.bloch-state-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.35rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.state-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.25rem;
    background: var(--surface-light);
    border-radius: 0.25rem;
}

.state-val {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
}

.state-lbl {
    font-size: 0.6rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Auto-adjust acquisition time toggle */
.auto-adjust-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.toggle-inline {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 18px;
}

.toggle-inline input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider-small {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface-light);
    transition: 0.3s;
    border-radius: 18px;
}

.toggle-slider-small::before {
    position: absolute;
    content: '';
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background: var(--text-secondary);
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-inline input:checked+.toggle-slider-small {
    background: var(--primary-color);
}

.toggle-inline input:checked+.toggle-slider-small::before {
    transform: translateX(18px);
    background: white;
}

.toggle-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.manual-acq-time {
    transition: opacity 0.3s ease;
}

.manual-acq-time.disabled {
    opacity: 0.5;
    pointer-events: none;
}