/* ============================================
   闪记赊账本 - 样式文件
   ============================================ */

:root {
    --bg: #f5f0eb;
    --card: #ffffff;
    --primary: #d4380d;
    --primary-light: #fff1f0;
    --text: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #e8d5c4;
    --success: #389e0d;
    --warning: #d48806;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 16px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* ===== SVG Icons ===== */
.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    fill: currentColor;
    vertical-align: -0.125em;
    flex-shrink: 0;
}
.icon-lg {
    width: 1.5em;
    height: 1.5em;
    vertical-align: -0.2em;
}
.icon-xl {
    width: 2em;
    height: 2em;
    vertical-align: -0.3em;
}
.icon-btn {
    width: 40px;
    height: 40px;
}
.icon-mic {
    width: 36px;
    height: 36px;
}

/* ===== 主容器 ===== */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ===== 头部 ===== */
.app-header {
    text-align: center;
    padding: 8px 0;
}
.app-header .logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.app-header .logo .icon {
    color: var(--primary);
}
.app-header .subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===== 统计卡片 ===== */
.stats-row {
    display: flex;
    gap: 12px;
}
.stat-card {
    flex: 1;
    background: var(--card);
    border-radius: var(--radius);
    padding: 14px 12px;
    box-shadow: var(--shadow);
    text-align: center;
}
.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--primary);
}
.stat-card.out .stat-value {
    color: var(--warning);
}
.stat-card.paid .stat-value {
    color: var(--success);
}
.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== 录音区域 ===== */
.record-section {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}
.record-btn-wrap {
    position: relative;
    display: inline-block;
}
.record-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(212, 56, 13, 0.35);
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.record-btn .icon {
    fill: #fff;
}
.record-btn:active {
    transform: scale(0.93);
    box-shadow: 0 2px 8px rgba(212, 56, 13, 0.25);
}
.record-btn.listening {
    animation: pulse 1.2s infinite;
    background: #cf1322;
    box-shadow: 0 0 0 0 rgba(212, 56, 13, 0.6);
}
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(212, 56, 13, 0.5);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(212, 56, 13, 0);
    }
}
.record-hint {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.3s;
}
.record-hint.active {
    color: var(--primary);
    font-weight: 500;
}
.record-transcript {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fafaf8;
    border-radius: 8px;
    font-size: 15px;
    color: #555;
    min-height: 40px;
    line-height: 1.5;
    word-break: break-all;
    border: 1px dashed var(--border);
}

/* ===== 解析结果预览 ===== */
.parse-preview {
    background: #fffbe6;
    border: 1px solid #ffe58f;
    border-radius: var(--radius);
    padding: 14px 16px;
    display: none;
    animation: slideDown 0.3s ease;
}
.parse-preview.show {
    display: block;
}
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.parse-preview .preview-title {
    font-size: 13px;
    font-weight: 600;
    color: #ad6800;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.parse-preview .preview-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 14px;
    margin: 3px 0;
    align-items: center;
}
.parse-preview .preview-row .tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #ffe58f;
}
.parse-preview .preview-row .tag .icon {
    width: 14px;
    height: 14px;
}
.parse-preview .btn-row {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

/* ===== 按钮 ===== */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn:active {
    transform: scale(0.96);
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-outline {
    background: #fff;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}
.btn .icon {
    width: 14px;
    height: 14px;
}
.btn-primary .icon {
    fill: #fff;
}
.btn-outline .icon {
    fill: var(--primary);
}
.btn-success .icon {
    fill: #fff;
}

/* ===== 记录列表 ===== */
.records-section {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}
.records-section .section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.records-section .section-title .count {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}
.record-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #fafaf8;
    transition: all 0.2s;
    gap: 10px;
    flex-wrap: wrap;
}
.record-item:last-child {
    margin-bottom: 0;
}
.record-item.paid {
    opacity: 0.6;
    background: #f6ffed;
}
.record-item .record-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.record-item .record-icon .icon {
    width: 18px;
    height: 18px;
}
.record-item .record-icon.in {
    background: #fff1f0;
    color: var(--primary);
}
.record-item .record-icon.out {
    background: #fffbe6;
    color: var(--warning);
}
.record-item .record-info {
    flex: 1;
    min-width: 120px;
}
.record-item .record-info .name {
    font-weight: 600;
    font-size: 15px;
}
.record-item .record-info .detail {
    font-size: 12px;
    color: var(--text-secondary);
}
.record-item .record-amount {
    font-weight: 700;
    font-size: 17px;
    white-space: nowrap;
}
.record-item .record-amount.in {
    color: var(--primary);
}
.record-item .record-amount.out {
    color: var(--warning);
}
.record-item .record-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 30px 0;
    color: var(--text-muted);
}
.empty-state .icon-wrap {
    font-size: 0;
    margin-bottom: 8px;
}
.empty-state .icon-wrap .icon {
    width: 48px;
    height: 48px;
    fill: #ccc;
}
.empty-state p {
    font-size: 14px;
    margin-top: 8px;
}



/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 200;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 1.5s forwards;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.toast .icon {
    width: 16px;
    height: 16px;
    fill: #fff;
}
@keyframes toastIn {
    from {
        opacity: 0;
        top: 0;
    }
    to {
        opacity: 1;
        top: 20px;
    }
}
@keyframes toastOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        top: 0;
    }
}

/* ===== 响应式 ===== */
@media (max-width: 360px) {
    .record-btn {
        width: 64px;
        height: 64px;
    }
    .record-btn .icon-mic {
        width: 28px;
        height: 28px;
    }
    .stats-row {
        gap: 8px;
    }
    .stat-card {
        padding: 10px 8px;
    }
    .stat-card .stat-value {
        font-size: 22px;
    }
    .record-item {
        padding: 10px;
        gap: 6px;
    }
}
