
/* 
 * 所有样式都添加了 .jtts- 前缀，防止与 WordPress 主题冲突 
 */

/* 通用 SVG 图标样式 */
.jtts-icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: currentColor;
}

/* 悬浮按钮样式 */
#jtts-read-btn {
    position: absolute; /* JS 会计算具体 top/left */
    display: none;
    z-index: 99999;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: #4f46e5; /* Indigo-600 */
    color: white;
    border: none;
    border-radius: 9999px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    transition: transform 0.1s, background-color 0.2s;
    line-height: 1.5;
}

#jtts-read-btn:hover {
    background-color: #4338ca; /* Indigo-700 */
    transform: scale(1.05);
}

/* 弹窗主面板 */
#jtts-reader-panel {
    position: fixed;
    display: none;
    width: 350px;
    max-width: 90vw;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-align: left; /* 强制左对齐，防止主题覆盖 */
}

/* 顶部拖拽栏 */
.jtts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    cursor: move; /* 拖拽手势 */
    user-select: none;
}

.jtts-title {
    font-size: 14px;
    font-weight: 700;
    color: #4f46e5;
    display: flex;
    align-items: center;
    gap: 8px;
}

.jtts-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jtts-close-btn:hover {
    color: #ef4444; /* Red-500 */
    background-color: #f1f5f9;
}

/* 文本区域 */
#jtts-text-area {
    width: 100%;
    height: 120px;
    padding: 16px;
    border: none;
    resize: none;
    outline: none;
    font-size: 15px;
    line-height: 1.6;
    color: #334155;
    box-sizing: border-box; /* 关键：防止 padding 撑大 */
    font-family: inherit;
}

#jtts-text-area::placeholder {
    color: #cbd5e1;
}

/* 控制面板区域 */
.jtts-controls {
    padding: 16px;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 第一行：音色和语速 */
.jtts-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 音色切换组 */
.jtts-voice-group {
    display: flex;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 2px;
}

.jtts-voice-btn {
    border: none;
    background: none;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

/* 激活状态 */
.jtts-voice-btn.jtts-active {
    background-color: #eef2ff;
    color: #4f46e5;
}

/* 下拉选框 */
.jtts-select {
    background-color: #fff;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

/* 生成按钮 */
#jtts-generate-btn {
    width: 100%;
    padding: 10px;
    background-color: #4f46e5;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

#jtts-generate-btn:hover {
    background-color: #4338ca;
}

/* 代理开关 */
.jtts-proxy-box {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #b45309; /* Yellow-700 */
    background-color: #fffbeb; /* Yellow-50 */
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #fef3c7;
}

/* 加载动画 */
.jtts-loader {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #4f46e5;
    border-radius: 50%;
    animation: jtts-spin 1s linear infinite;
}

@keyframes jtts-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.jtts-hidden {
    display: none !important;
}

.jtts-flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #4f46e5;
    font-size: 12px;
    padding: 8px;
}

.jtts-error {
    font-size: 12px;
    color: #ef4444;
    background-color: #fef2f2;
    border: 1px solid #fee2e2;
    padding: 8px;
    border-radius: 4px;
    text-align: center;
}

#jtts-audio-player {
    width: 100%;
    height: 32px;
    margin-top: 4px;
}
