* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0f0f1a;
    --surface: #1a1a2e;
    --surface-2: #232342;
    --text: #e8e8f0;
    --text-dim: #8888a0;
    --accent: #6c63ff;
    --accent-glow: rgba(108, 99, 255, 0.3);
    --red: #ff4757;
    --red-glow: rgba(255, 71, 87, 0.4);
    --green: #2ed573;
    --yellow: #ffa502;
    --radius: 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px;
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10;
}

header h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: var(--surface);
    border: none;
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: var(--surface-2);
}

/* Search */
.search-bar {
    padding: 0 0 12px;
    transition: all 0.3s;
}

.search-bar.hidden {
    display: none;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--surface-2);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 15px;
    outline: none;
}

.search-bar input:focus {
    border-color: var(--accent);
}

/* Record Section */
.record-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 0;
}

.record-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--surface-2);
    background: var(--surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
}

.record-btn:hover {
    border-color: var(--red);
    box-shadow: 0 0 20px var(--red-glow);
}

.record-btn.recording {
    border-color: var(--red);
    box-shadow: 0 0 30px var(--red-glow);
    animation: pulse 1.5s infinite;
}

.record-icon {
    width: 32px;
    height: 32px;
    background: var(--red);
    border-radius: 50%;
    transition: all 0.3s;
}

.record-btn.recording .record-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 20px var(--red-glow); }
    50% { box-shadow: 0 0 40px var(--red-glow); }
}

.record-status {
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-dim);
}

.record-timer {
    margin-top: 4px;
    font-size: 28px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.record-timer.hidden {
    display: none;
}

/* Recordings List */
.recordings-list {
    padding-bottom: 24px;
}

.recording-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.recording-card:hover {
    background: var(--surface-2);
    border-color: var(--accent);
}

.recording-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.recording-card .card-title {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
    margin-right: 8px;
}

.recording-card .card-date {
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
}

.recording-card .card-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-dim);
}

.recording-card .card-preview {
    font-size: 14px;
    color: var(--text-dim);
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
}

.status-processing {
    background: rgba(255, 165, 2, 0.15);
    color: var(--yellow);
}

.status-complete {
    background: rgba(46, 213, 115, 0.15);
    color: var(--green);
}

.status-error {
    background: rgba(255, 71, 87, 0.15);
    color: var(--red);
}

/* Detail View */
.detail-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 100;
    overflow-y: auto;
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.detail-view.hidden {
    display: none;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 15px;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 16px;
}

.detail-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.detail-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 10px;
}

.detail-section p, .detail-section li {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
}

.detail-section ul {
    list-style: none;
    padding: 0;
}

.detail-section ul li {
    padding: 6px 0;
    padding-left: 16px;
    position: relative;
}

.detail-section ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
}

.topic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.topic-tag {
    padding: 4px 12px;
    background: var(--surface-2);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text);
}

.transcript-text {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text);
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.delete-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--red);
    border-radius: var(--radius);
    color: var(--red);
    font-size: 15px;
    cursor: pointer;
    margin-top: 32px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 400px;
}

.modal-content h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

.modal-content input[type="file"] {
    width: 100%;
    margin-bottom: 12px;
    color: var(--text);
}

.modal-content input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--surface-2);
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
    outline: none;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
}

.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-dim);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 15px;
}

/* Spinner for processing */
.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--yellow);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
