/* ========== 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;
}

/* ========== 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;
}
