/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.6;
    min-height: 100vh;
}

/* ─── App Container ─── */
.app {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ─── Header ─── */
.header {
    text-align: center;
    margin-bottom: 32px;
}
.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a2e;
}
.subtitle {
    color: #666;
    font-size: 0.95rem;
    margin-top: 4px;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-start {
    background: #1a1a2e;
    color: #fff;
}
.btn-start:hover { background: #2d2d4e; }

.btn-stop {
    background: #e63946;
    color: #fff;
    animation: btn-pulse 2s infinite;
}
.btn-stop:hover { background: #c1121f; }

.btn-icon { font-size: 0.8em; }

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
    background: #1a1a2e;
    color: #fff;
}
.btn-small:hover { background: #2d2d4e; }

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}
.btn-secondary:hover { background: #d0d0d0; }

@keyframes btn-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(230, 57, 70, 0); }
}

/* ─── Recorder ─── */
.recorder {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}

.recording-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    font-size: 1.4rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.pulse {
    width: 12px;
    height: 12px;
    background: #e63946;
    border-radius: 50%;
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.chunk-status {
    font-size: 0.75rem;
    color: #888;
    font-weight: 400;
}

.error-msg {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fff0f0;
    color: #c1121f;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* ─── Results Section ─── */
.results-section {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}
.results-section h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
}

.results-back {
    margin-bottom: 12px;
}
.btn-back {
    background: #e0e0e0;
    color: #333;
}
.btn-back:hover {
    background: #d0d0d0;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.results-header h2 {
    margin-bottom: 0;
    flex: 1;
    min-width: 200px;
}
.results-header h2[contenteditable="true"] {
    border-bottom: 2px dashed #ccc;
    outline: none;
    padding-bottom: 2px;
}
.results-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ─── Timeline ─── */
.timeline-container {
    margin-bottom: 24px;
    padding: 0 4px;
}
.timeline-bar {
    position: relative;
    height: 40px;
    background: #f0f2f5;
    border-radius: 20px;
    overflow: visible;
}
.timeline-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    background: #1a1a2e;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s;
    z-index: 1;
}
.timeline-marker:hover,
.timeline-marker.active {
    width: 24px;
    height: 24px;
    background: #e63946;
    box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.25);
}
.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
    padding: 0 2px;
}

/* ─── Comments List ─── */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    background: #f8f9fa;
    transition: background 0.15s;
    align-items: flex-start;
    cursor: pointer;
}
.comment-item:hover { background: #eef0f4; }
.comment-delete {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}
.comment-delete:hover {
    color: #e63946;
    background: rgba(230, 57, 70, 0.1);
}
.comment-item.highlight {
    background: #fff3cd;
}
.comment-item.highlight .comment-time {
    color: #e63946;
}

.comment-time {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1a1a2e;
    white-space: nowrap;
    min-width: 60px;
    padding-top: 2px;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
}
.comment-time:hover { color: #e63946; }

.comment-text {
    flex: 1;
    min-width: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/* ─── Sessions List ─── */
.sessions-section {
    margin-top: 8px;
}
.sessions-section h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.session-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.15s;
}
.session-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.session-info {
    flex: 1;
}
.session-title {
    font-weight: 600;
    font-size: 0.95rem;
}
.session-meta {
    font-size: 0.8rem;
    color: #888;
    margin-top: 2px;
}

.session-delete {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}
.session-delete:hover {
    color: #e63946;
    background: #fff0f0;
}

.no-sessions {
    text-align: center;
    color: #888;
    padding: 24px;
    font-size: 0.95rem;
}

/* ─── Toast ─── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1a1a2e;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    opacity: 0;
    transition: all 0.3s;
    z-index: 100;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── Utilities ─── */
.hidden { display: none !important; }
.loading { color: #888; text-align: center; padding: 16px; }

/* ─── Responsive ─── */
@media (max-width: 600px) {
    .app { padding: 16px 12px; }
    .recorder { padding: 24px 16px; }
    .btn { padding: 12px 20px; font-size: 1rem; }
    .results-header { flex-direction: column; align-items: flex-start; }
    .comment-item { gap: 8px; padding: 10px; flex-wrap: wrap; }
    .comment-text {
        width: 100%;
        font-size: 0.9rem;
    }
    .timeline-marker {
        width: 20px;
        height: 20px;
    }
    .timeline-marker:hover,
    .timeline-marker.active {
        width: 26px;
        height: 26px;
    }
    .timeline-bar {
        height: 44px;
    }
}
