/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body {
    background-color: #f5f7fa;
    color: #333;
    min-height: 100vh;
    padding: 24px 16px;
}

/* ========== Layout ========== */
.container {
    max-width: 1400px;
    margin: 0 auto;
}
.grid-wrap {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}
@media (min-width: 1024px) {
    .grid-wrap {
        grid-template-columns: 380px 1fr;
        align-items: start;
    }
}

/* ========== Header ========== */
header {
    margin-bottom: 24px;
}
.header-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}
.logo-box {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background-color: #673AB7;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 20px;
}
.logo-text h1 {
    font-size: 20px;
    font-weight: bold;
}
.logo-text p {
    font-size: 13px;
    color: #666;
    margin-top: 2px;
}
.header-buttons {
    display: flex;
    gap: 12px;
}

/* ========== 额度条 ========== */
.quota-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #e2e5ec;
    border-radius: 999px;
    font-size: 13px;
    color: #555;
}
.quota-item {
    white-space: nowrap;
}
.quota-sep {
    width: 1px;
    height: 14px;
    background: #e2e5ec;
}
.quota-share {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    color: #673AB7;
    border-color: #d9c7f2;
    background: #f6f0ff;
}
.quota-share:hover:not(:disabled) {
    background: #efe4ff;
}

/* ========== 邀请弹窗 ========== */
.invite-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.invite-label {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}
.invite-code {
    font-size: 16px;
    letter-spacing: 2px;
    color: #673AB7;
}
.invite-link {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #e2e5ec;
    border-radius: 8px;
    font-size: 12px;
    color: #555;
    background: #fafafa;
}

/* ========== 微信绑定弹窗 ========== */
.bind-qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.bind-qr {
    display: none;
    width: 200px;
    height: 200px;
    border-radius: 10px;
    border: 1px solid #eee;
    background: #fff;
}
.bind-qr-tip {
    font-size: 12px;
    color: #888;
    text-align: center;
}

/* ========== Buttons ========== */
.btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #e2e5ec;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
}
.btn:hover:not(:disabled) {
    background-color: #f3f4f6;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-primary {
    background-color: #673AB7;
    color: #fff;
    border-color: #673AB7;
}
.btn-primary:hover:not(:disabled) {
    background-color: #8e54d8;
}
.btn-green {
    background-color: #16a34a;
    color: #fff;
    border-color: #16a34a;
}
.btn-green:hover:not(:disabled) {
    background-color: #15803d;
}
.action-btn {
    padding: 6px 12px;
    border: 1px solid #e2e5ec;
    background: #fff;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}
.action-btn:hover {
    background: #f5f7fa;
}

/* ========== Card Components ========== */
.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.card + .card {
    margin-top: 24px;
}
.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.card-title {
    font-size: 18px;
    font-weight: 600;
}
.tag-pro {
    font-size: 12px;
    color: #673AB7;
    background-color: #f4f0fb;
    padding: 2px 8px;
    border-radius: 6px;
}

/* ========== Tag List ========== */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 4px;
    margin-bottom: 8px;
}
.tag {
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 12.5px;
    background-color: #f5f7fa;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.tag .count {
    display: inline-block;
    margin-left: 4px;
    font-size: 11px;
    color: #999;
}
.tag.active {
    background-color: #673AB7;
    color: white;
}
.tag.active .count {
    color: #ddd;
}

/* ========== Search & Filter ========== */
.search-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.voice-search {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid #e2e5ec;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: 0.2s;
}
.voice-search:focus {
    border-color: #673AB7;
    box-shadow: 0 0 0 3px rgba(103, 58, 183, 0.15);
}
.result-count {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    min-width: 40px;
    text-align: right;
}
.sub-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #666;
}
.sub-filter label {
    font-size: 13px;
    font-weight: 500;
}
.sub-filter select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #e2e5ec;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    cursor: pointer;
    outline: none;
}
.sub-filter select:focus {
    border-color: #673AB7;
}

/* ========== Voice List (动态主播列表) ========== */
.voice-list {
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
    margin-bottom: 8px;
}
.voice-list::-webkit-scrollbar {
    width: 6px;
}
.voice-list::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}
.loading {
    padding: 32px;
    text-align: center;
    color: #999;
    font-size: 14px;
}
.voice-item {
    background-color: #f5f7fa;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: 0.2s;
    border: 2px solid transparent;
}
.voice-item:hover {
    background-color: #eceff4;
}
.voice-item.active {
    background-color: #f4f0fb;
    border-color: #673AB7;
}
.voice-item .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #fff;
    border: 2px solid #e2e5ec;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    font-size: 22px;
    border-color: transparent;
}
.voice-item.active .avatar {
    border-color: #673AB7;
    color: #673AB7;
}
.voice-meta h4 {
    font-size: 15px;
}
.voice-meta p {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}
.voice-tag {
    display: inline-block;
    font-size: 11px;
    background: #ede7f6;
    color: #673AB7;
    padding: 2px 7px;
    border-radius: 4px;
    margin-top: 4px;
}
.voice-item .play-sm {
    margin-left: auto;
    font-size: 18px;
    color: #999;
}
.voice-item.active .play-sm {
    color: #673AB7;
}

/* ========== Slider Controls ========== */
.slider-group {
    margin-top: 16px;
}
.slider-item {
    margin-bottom: 18px;
}
.slider-head {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 6px;
}
input[type="range"] {
    width: 100%;
    accent-color: #673AB7;
}

/* ========== Utilities ========== */
.divider {
    height: 1px;
    background: #e2e5ec;
    margin: 20px 0;
}
.gray-tip {
    color: #999;
    font-size: 14px;
}

/* ========== Text Editor Area ========== */
.text-head-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.stat-info {
    font-size: 14px;
    color: #666;
}
textarea {
    width: 100%;
    min-height: 280px;
    padding: 16px;
    border: 1px solid #e2e5ec;
    border-radius: 8px;
    resize: vertical;
    font-size: 15px;
}
textarea:focus {
    outline: none;
    border-color: #673AB7;
    box-shadow: 0 0 0 3px rgba(103, 58, 183, 0.15);
}
.text-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}
.control-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

/* ========== Result Area ========== */
.result-empty {
    background-color: #f5f7fa;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    color: #999;
}
.result-empty .icon {
    font-size: 32px;
    margin-bottom: 8px;
}
.hidden {
    display: none !important;
}

/* ========== Audio Player ========== */
.audio-player {
    background-color: #f5f7fa;
    border-radius: 8px;
    padding: 16px;
}
.audio-player audio {
    width: 100%;
    outline: none;
}
.audio-info {
    margin-top: 10px;
    font-size: 12px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}
.divider-v {
    width: 1px;
    height: 12px;
    background: #ccc;
}

/* ========== Modal (History) ========== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
}
.modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 560px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e5ec;
}
.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
}
.history-item {
    background: #f5f7fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}
.history-item h5 {
    font-size: 13px;
    color: #673AB7;
    margin-bottom: 4px;
}
.history-item p {
    font-size: 13px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.history-item .history-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 200;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    opacity: 0.95;
    transition: opacity 0.2s;
}
.toast.error {
    background: #dc2626;
}
.toast.success {
    background: #16a34a;
}

/* ========== Footer ========== */
.site-footer {
    margin-top: 32px;
    padding: 16px 0;
    text-align: center;
    font-size: 13px;
    color: #999;
}
.site-footer a {
    color: #999;
    text-decoration: none;
}
.site-footer a:hover {
    color: #673AB7;
}

/* ========== 翻译结果卡片 ========== */
.trans-text {
    background: #f7f4fd;
    border: 1px solid #e8ddf8;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 15px;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 260px;
    overflow-y: auto;
}
.trans-tip {
    margin-top: 10px;
    font-size: 12px;
}

/* ========== 弹窗补充 ========== */
.modal-sm {
    max-width: 420px;
}
.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #e2e5ec;
    display: flex;
    justify-content: center;
}
.modal-footer .action-btn {
    color: #dc2626;
    border-color: #f3c7c7;
}
.modal-footer .action-btn:hover {
    background: #fef2f2;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

/* ========== 文案模板 ========== */
.tpl-item {
    border: 1px solid #e2e5ec;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: 0.2s;
}
.tpl-item:hover {
    border-color: #673AB7;
    background: #faf7ff;
}
.tpl-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.tpl-name {
    font-size: 15px;
    font-weight: 600;
}
.tpl-tag {
    font-size: 11px;
    color: #673AB7;
    background: #f4f0fb;
    padding: 2px 7px;
    border-radius: 4px;
}
.tpl-text {
    font-size: 13px;
    color: #666;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* ========== 历史记录补充 ========== */
.history-item .history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}
.history-item h5 {
    margin-bottom: 0;
}
.history-lang {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
}
.history-trans {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e2e5ec;
}
.history-trans-label {
    font-size: 11px;
    color: #673AB7;
    margin-bottom: 2px;
}
.history-trans p {
    color: #555;
}

/* ========== 等待进度面板 ========== */
.wait-mask {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(17, 24, 39, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.wait-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    padding: 22px 20px 16px;
    box-shadow: 0 20px 60px rgba(17, 24, 39, 0.2);
    animation: waitIn 0.24s ease-out;
}
@keyframes waitIn {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to   { opacity: 1; transform: none; }
}
.wait-head {
    display: flex;
    align-items: center;
}
.wait-spinner {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    margin-right: 10px;
    border-radius: 50%;
    border: 3px solid #e8ddf8;
    border-top-color: #673AB7;
    animation: waitSpin 0.8s linear infinite;
}
@keyframes waitSpin {
    to { transform: rotate(360deg); }
}
.wait-head-text {
    flex: 1;
    min-width: 0;
}
.wait-title {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
}
.wait-tip {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 3px;
    min-height: 16px;
}
.wait-percent {
    flex-shrink: 0;
    margin-left: 8px;
    font-size: 18px;
    font-weight: 800;
    color: #673AB7;
    font-variant-numeric: tabular-nums;
}
.wait-bar {
    height: 8px;
    margin-top: 14px;
    background: #f1ecfa;
    border-radius: 999px;
    overflow: hidden;
}
.wait-bar-inner {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #673AB7 0%, #8e54d8 100%);
    box-shadow: 0 2px 10px rgba(103, 58, 183, 0.35);
    transition: width 0.25s ease-out;
}
.wait-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 12px;
    color: #9ca3af;
    min-height: 16px;
}
.wait-steps {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #eceff4;
}
.wait-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}
.wait-step-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    background: #f1f3f7;
    color: #9ca3af;
    font-weight: 600;
}
.wait-step-label {
    font-size: 12px;
    color: #9ca3af;
}
.wait-step-active .wait-step-dot {
    background: #673AB7;
    color: #fff;
}
.wait-step-active .wait-step-label {
    color: #673AB7;
    font-weight: 600;
}
.wait-step-done .wait-step-dot {
    background: #ece4f9;
    color: #673AB7;
}
.wait-step-done .wait-step-label {
    color: #673AB7;
}
