@font-face {
    font-family: 'Hat';
    src: url('hat.ttf') format('truetype');
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Hat', Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    min-height: 100vh;
    color: #333;
    display: flex;
    flex-direction: row;
    padding: 20px;
    overflow-x: hidden;
    font-family: 'Hat', Arial, sans-serif;
}

.container {
    width: 100%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
    animation: fadeIn 0.8s ease-out;
    margin: 0 auto;
    position: relative;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.header {
    text-align: center;
    margin-bottom: 25px;
}

h1 {
    color: white;
    margin-bottom: 10px;
    font-size: 24px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.language-switcher {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    margin: 0 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.5);
    font-weight: bold;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.input-section {
    margin-bottom: 20px;
}

.input-group {
    position: relative;
    margin-bottom: 15px;
}

input {
    width: 100%;
    padding: 15px 50px 15px 15px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 1);
}

.clear-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    color: #888;
    cursor: pointer;
    transition: color 0.3s;
}

.clear-btn:hover {
    color: #ff4757;
}

.submit-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #ff7e5f, #feb47b);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

.btn-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #ff7e5f, #feb47b);
}

.loader {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid white;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

.result-container {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.article-info {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.article-cover-container {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.article-cover {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 15px;
    border: 1px solid #ddd;
}

.cover-copy-btn {
    padding: 8px 12px;
    background: linear-gradient(135deg, #2ed573, #1e90ff);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.cover-copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.article-title-container {
    display: flex;
    align-items: flex-start;
}

.article-title {
    flex: 1;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    line-height: 1.4;
}

.title-copy-btn {
    padding: 8px 12px;
    background: linear-gradient(135deg, #2ed573, #1e90ff);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 10px;
    transition: all 0.3s;
    white-space: nowrap;
}

.title-copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.audio-info {
    margin-bottom: 15px;
}

.audio-id {
    background: #f1f2f6;
    padding: 12px;
    border-radius: 8px;
    font-family: monospace;
    word-break: break-all;
    margin-bottom: 10px;
    border: 1px dashed #a4b0be;
}

.copy-btn {
    display: block;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #2ed573, #1e90ff);
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.audio-player {
    width: 100%;
    margin-top: 15px;
    border-radius: 8px;
}

.no-audio {
    text-align: center;
    color: #ff4757;
    font-weight: bold;
    padding: 20px;
}

.footer {
    text-align: center;
    margin-top: 15px;
}

.footer p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

/* 提示框样式 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 2000; /* 确保在侧边栏之上 */
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 80%;
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* 响应式调整提示框位置 */
@media (max-width: 768px) {
    .toast {
        left: calc(50% + 100px); /* 适配较窄的侧边栏 */
    }
}

@media (max-width: 480px) {
    .toast {
        left: calc(50% + 80px); /* 适配更窄的侧边栏 */
        padding: 10px 16px;
        font-size: 14px;
    }
}

@media (max-width: 360px) {
    .toast {
        left: calc(50% + 70px); /* 适配极小屏幕 */
        padding: 8px 12px;
        font-size: 12px;
    }
}

.toast.success {
    background: rgba(46, 213, 115, 0.9);
}

.toast.error {
    background: rgba(255, 71, 87, 0.9);
}

/* 响应式设计 */
@media (min-width: 768px) {
    .container {
        padding: 40px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    .header p {
        font-size: 16px;
    }
    
    .lang-btn {
        padding: 10px 25px;
        font-size: 16px;
    }
    
    input {
        padding: 18px 50px 18px 18px;
        font-size: 18px;
    }
    
    .submit-btn {
        padding: 18px;
        font-size: 18px;
    }
    
    .article-cover {
        width: 100px;
        height: 100px;
    }
    
    .article-title {
        font-size: 18px;
    }
    
    .cover-copy-btn, .title-copy-btn {
        font-size: 14px;
        padding: 10px 15px;
    }
    
    .audio-id {
        font-size: 16px;
    }
    
    .copy-btn {
        font-size: 16px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px;
        border-radius: 15px;
    }
    
    h1 {
        font-size: 20px;
    }
    
    .header p {
        font-size: 12px;
    }
    
    .lang-btn {
        padding: 6px 15px;
        font-size: 12px;
    }
    
    input {
        padding: 12px 45px 12px 12px;
        font-size: 14px;
    }
    
    .submit-btn {
        padding: 12px;
        font-size: 14px;
    }
    
    .article-cover {
        width: 60px;
        height: 60px;
    }
    
    .article-title {
        font-size: 14px;
    }
    
    .cover-copy-btn, .title-copy-btn {
        font-size: 10px;
        padding: 6px 10px;
    }
    
    .audio-id {
        font-size: 12px;
    }
    
    .copy-btn {
        font-size: 12px;
        padding: 10px;
    }
}

/* RTL和LTR样式支持 */
[dir="rtl"] .article-cover {
    margin-right: 0;
    margin-left: 15px;
}

[dir="rtl"] .title-copy-btn {
    margin-left: 0;
    margin-right: 10px;
}

[dir="rtl"] .clear-btn {
    right: auto;
    left: 15px;
}

[dir="ltr"] {
    text-align: left;
}

[dir="rtl"] {
    text-align: right;
}
