:root {
    --primary-color: #6200ee;
    --primary-light: #b794f6;
    --danger-color: #cf6679;
    --success-color: #03dac6;
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --text-color: #ffffff;
    --text-secondary: #b0b0b0;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

.logo {
    width: 250px;
    height: auto;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

h1 {
    font-weight: 300;
    margin-bottom: 0.5rem;
}

p {
    color: var(--text-secondary);
}

.nav-link {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--primary-light);
    text-decoration: none;
    font-size: 0.9rem;
}

.nav-link:hover {
    text-decoration: underline;
}

.recorder-container {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: 16px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    margin-bottom: 2rem;
}

.visualizer {
    height: 60px;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2rem;
    opacity: 0.3;
    transition: opacity 0.3s;
}

.visualizer.recording {
    opacity: 1;
}

.bar {
    width: 6px;
    height: 15%;
    background-color: var(--primary-light);
    border-radius: 3px;
    transition: height 0.05s ease-out;
}

.record-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background-color: var(--primary-color);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    outline: none;
}

.record-btn:hover {
    transform: scale(1.05);
    background-color: #7c4dff;
}

.record-btn.recording {
    background-color: var(--danger-color);
    animation: pulse 2s infinite;
}

.record-btn .icon {
    width: 20px;
    height: 20px;
    background-color: white;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z'/%3E%3Cpath d='M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z'/%3E%3C/svg%3E") no-repeat center;
    mask-size: contain;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z'/%3E%3Cpath d='M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask-size: contain;
    margin-bottom: 4px;
}

.record-btn.recording .icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background-color: white;
    mask: none;
    -webkit-mask: none;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(207, 102, 121, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(207, 102, 121, 0); }
    100% { box-shadow: 0 0 0 0 rgba(207, 102, 121, 0); }
}

.status {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.results-container {
    width: 100%;
    background-color: var(--surface-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.hidden {
    display: none;
}

.verdict {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.verdict .label {
    font-size: 1.2rem;
    font-weight: 500;
}

.verdict .value {
    font-size: 1.5rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.value.yes {
    background-color: rgba(207, 102, 121, 0.2);
    color: var(--danger-color);
}

.value.no {
    background-color: rgba(3, 218, 198, 0.2);
    color: var(--success-color);
}

.inference-time {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 1.5rem;
}

.predictions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pred-item {
    display: flex;
    flex-direction: column;
}

.pred-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.pred-bar-bg {
    width: 100%;
    height: 8px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.pred-bar-fill {
    height: 100%;
    background-color: var(--primary-light);
    border-radius: 4px;
    width: 0%;
    transition: width 1s ease-out;
}

/* Tooltip styles */
.tooltip-trigger {
    position: relative;
    cursor: help;
}

.tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    padding: 12px;
    background-color: #2d2d2d;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-secondary);
    white-space: normal;
    width: 300px;
    max-width: 80vw;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    line-height: 1.5;
}

.tooltip.tooltip-left {
    left: auto;
    right: 0;
}

.tooltip-trigger:hover .tooltip {
    display: block;
}

.tooltip strong {
    color: var(--text-color);
}

.tooltip:empty {
    display: none;
}

/* Event timeline styles */
.event-timeline {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.event-timeline h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 500;
}

.event-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.event-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background-color: rgba(207, 102, 121, 0.15);
    border-radius: 8px;
    border-left: 3px solid var(--danger-color);
    font-size: 0.9rem;
}

.event-time {
    flex-shrink: 0;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--primary-light);
    margin-right: 1rem;
    min-width: 90px;
}

.event-label {
    flex-grow: 1;
    font-weight: 500;
}

.event-confidence {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

/* Histogram / heatmap styles */
.histogram-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.histogram-section h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 500;
}

.histogram-container {
    display: flex;
    gap: 8px;
}

.histogram-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-secondary);
    min-width: 100px;
    max-width: 100px;
    padding: 2px 0;
}

.histogram-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 16px;
    line-height: 16px;
}

.histogram-label.alarming {
    color: var(--danger-color);
}

.histogram-label.safe {
    color: var(--success-color);
}

.histogram-canvas-wrapper {
    flex-grow: 1;
    position: relative;
    height: auto;
    border-radius: 4px;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.3);
}

#histogramCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    background-color: white;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
    pointer-events: none;
    display: none;
}

.playhead.active {
    display: block;
}

.histogram-time-axis {
    display: flex;
    justify-content: space-between;
    margin-left: 108px;
    margin-top: 4px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.playback-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.play-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.play-btn:hover {
    background-color: #7c4dff;
}

.play-btn.playing {
    background-color: var(--danger-color);
}

.play-icon {
    width: 16px;
    height: 16px;
    background-color: white;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E") no-repeat center;
    mask-size: contain;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask-size: contain;
}

.play-btn.playing .play-icon {
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 19h4V5H6v14zm8-14v14h4V5h-4z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 19h4V5H6v14zm8-14v14h4V5h-4z'/%3E%3C/svg%3E") no-repeat center;
}

.playback-time {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
