/* 基础样式 */
.bg-light {
    background-color: #f8f9fa;
}

/* 强制停止按钮样式 */
.force-stop-btn {
    display: flex;
    align-items: center;
}

.force-stop-btn .btn {
    width: 36px;  /* 从 40px 减小到 36px */
    height: 36px; /* 从 40px 减小到 36px */
    transition: transform 0.2s ease;
}

.force-stop-btn .btn:hover {
    transform: scale(1.2);
}

.force-stop-btn .btn i {
    font-size: 1.1rem;  /* 从 1.25rem 减小到 1.1rem */
}

/* 全局按钮焦点样式 */
*:focus {
    outline: 0 !important;
    box-shadow: none !important;
}

.btn:focus,
.btn:active,
.btn:hover,
.btn:focus-visible,
button:focus,
button:active,
button:hover,
button:focus-visible {
    outline: 0 !important;
    box-shadow: none !important;
}

/* 文本区域样式 */
textarea {
    white-space: pre-wrap;
    font-family: var(--text-primary);
    resize: none;
}

/* 导航栏样式 */
.navbar-brand img {
    max-width: 10%;
    height: auto;
}

/* 导航栏按钮样式 */
.navbar-nav .btn {
    white-space: nowrap;
    min-width: fit-content;
    margin: 0 5px;
}

/* 特别处理 outline-secondary 类型按钮 */
.btn-outline-secondary:focus,
.btn-outline-secondary.focus,
.btn-outline-secondary:active,
.btn-outline-secondary:active:focus,
.btn-outline-secondary:focus-visible {
    box-shadow: none !important;
    outline: none !important;
}

/* 特别处理 outline-danger 类型按钮 */
.btn-outline-danger:focus,
.btn-outline-danger.focus,
.btn-outline-danger:active,
.btn-outline-danger:active:focus,
.btn-outline-danger:focus-visible {
    box-shadow: none !important;
    outline: none !important;
}

/* 工具按钮样式 */
.tool-buttons {
    text-align: right;
    margin-bottom: 10px;
    margin-top: 5px;
}

/* 表单标签样式 */
.form-label {
    margin-bottom: 0.2rem;
    font-weight: 500;
}

/* 进度条容器样式 */
#progress_bar_container {
    display: none;
    margin: 20px 0;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
}

.progress {
    background-color: #e9ecef;
    height: 20px;
}

.progress-bar {
    background-color: #0d6efd;
    transition: width 0.3s ease;
    width: 100%;
}

/* 音频播放器样式 */
#audio_player {
    display: none;
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-20px);
}

/* 音频控制区域样式 */
.audio-controls {
    margin-top: 10px;
}

/* 下载按钮默认隐藏 */
#download_button {
    display: none;
}

/* 深色模式样式 */
[data-theme="dark"] {
    /* 背景色 */
    --bg-primary: #1a1d20;
    --bg-secondary: #2b2f33;
    --bg-card: #2b2f33;
    
    /* 文本颜色 */
    --text-primary: #e9ecef;
    --text-secondary: #ced4da;
    --text-muted: #adb5bd;
    
    /* 边框颜色 */
    --border-color: #373b3e;
    
    /* 按钮颜色 */
    --btn-bg: #373b3e;
    --btn-border: #6c757d;
    --btn-text: #e9ecef;
}

/* 浅色模式样式 */
[data-theme="light"] {
    /* 背景色 */
    --bg-primary: #f8f9fa;
    --bg-secondary: #e9ecef;
    --bg-card: #ffffff;
    
    /* 文本颜色 */
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    
    /* 边框颜色 */
    --border-color: #dee2e6;
    
    /* 按钮颜色 */
    --btn-bg: #ffffff;
    --btn-border: #ced4da;
    --btn-text: #212529;
}

/* 应用主题变量 */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.card {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

.form-control {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.form-control:focus {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-outline-secondary {
    border-color: var(--btn-border);
    color: var(--text-primary);
}

.btn-outline-secondary:hover {
    background-color: var(--btn-bg);
    border-color: var(--btn-border);
    color: var(--text-primary);
}

/* Footer 样式 */
.footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
}

.theme-switcher {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

/* 图标样式 */
.bi {
    font-size: 1.1em;
    vertical-align: -0.125em;
}

/* 深色模式下的按钮样式调整 */
[data-theme="dark"] .btn-outline-secondary {
    border-color: var(--btn-border);
    color: var(--text-primary);
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--btn-border);
    border-color: var(--btn-border);
    color: var(--text-primary);
}

[data-theme="dark"] .btn-outline-secondary.active {
    background-color: var(--btn-border);
    border-color: var(--btn-border);
    color: var(--text-primary);
}

/* 深色模式下的输入框样式调整 */
[data-theme="dark"] .form-control {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .form-control:focus {
    background-color: var(--bg-secondary);
    border-color: var(--btn-border);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.25rem rgba(108, 117, 125, 0.25);
}

/* 深色模式下的主按钮样式 */
[data-theme="dark"] .btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
}

[data-theme="dark"] .btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* 深色模式下的导航栏样式 */
[data-theme="dark"] .navbar {
    background-color: var(--bg-card) !important;  /* 使用深色背景 */
}

[data-theme="dark"] .navbar-light .navbar-nav .nav-link {
    color: var(--text-primary);
}

[data-theme="dark"] .navbar-light .navbar-brand {
    color: var(--text-primary);
}

[data-theme="dark"] .navbar-light .navbar-toggler {
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .navbar-light .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(233, 236, 239, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* 修改导航栏下拉菜单的样式 */
[data-theme="dark"] .navbar-collapse {
    background-color: var(--bg-card);
    padding: 1rem;
    border-radius: 0.375rem;
}

/* 导航栏按钮样式 */
[data-theme="dark"] .navbar-nav .btn {
    color: var(--text-primary);
    border-color: var(--btn-border);
}

[data-theme="dark"] .navbar-nav .btn:hover {
    background-color: var(--btn-border);
    color: var(--text-primary);
}

/* 导航栏中的 Logout 按钮样式 */
[data-theme="dark"] .navbar-nav .btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
}

[data-theme="dark"] .navbar-nav .btn-outline-danger:hover {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

/* 深色模式下的进度条样式 */
[data-theme="dark"] .progress {
    background-color: #343a40;  /* 使用稍深一点的背景色 */
}

[data-theme="dark"] .progress-bar-striped {
    background-image: linear-gradient(45deg,
        rgba(255,255,255,.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255,255,255,.15) 50%,
        rgba(255,255,255,.15) 75%,
        transparent 75%,
        transparent);
}

[data-theme="dark"] #progress_bar_container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .form-control::placeholder {
    color: #868e96;  /* 使用较亮的灰色 */
    opacity: 1;
}

[data-theme="dark"] .form-control::-webkit-input-placeholder {
    color: #868e96;
    opacity: 1;
}

[data-theme="dark"] .form-control::-moz-placeholder {
    color: #868e96;
    opacity: 1;
}

[data-theme="dark"] .form-control:-ms-input-placeholder {
    color: #868e96;
    opacity: 1;
}

[data-theme="dark"] .form-control::-ms-input-placeholder {
    color: #868e96;
    opacity: 1;
}

#record_button:hover {
    /* 禁用 hover 效果 */
    filter: none !important;
    opacity: 1 !important;
    background-color: var(--bs-danger) !important;
    border-color: var(--bs-danger) !important;
}

#record_button.btn-success:hover {
    /* 录音时的绿色状态也禁用 hover 效果 */
    background-color: var(--bs-success) !important;
    border-color: var(--bs-success) !important;
}

/* 音频可视化器样式 */
.audio-visualizer {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 20px;
}

.audio-visualizer .bar {
    width: 3px;
    height: 3px;
    background-color: #6c757d;
    border-radius: 1px;
    transition: height 0.1s ease;
}

.audio-visualizer.active .bar {
    animation: sound 0.5s linear infinite alternate;
}

.audio-visualizer.active .bar:nth-child(1) { animation-delay: 0.0s; }
.audio-visualizer.active .bar:nth-child(2) { animation-delay: 0.1s; }
.audio-visualizer.active .bar:nth-child(3) { animation-delay: 0.2s; }
.audio-visualizer.active .bar:nth-child(4) { animation-delay: 0.3s; }
.audio-visualizer.active .bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes sound {
    0% { height: 3px; }
    100% { height: 20px; }
}

/* 隐藏元素 */
#audio_file_input,
#audio_progress_bar_container {
    display: none;
}

/* 页面特定样式 */

/* About 页面 */
.about-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
}

.about-page__content {
    max-width: 600px;
}

.about-page__buttons {
    margin-top: 20px;
}

/* 翻译页面特定样式 */
#target_message {
    white-space: pre-wrap;  /* 保留换行和空格 */
    user-select: none;      /* 禁止文本选择 */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#origin_message {
    min-height: 4.5em;  /* 相当于 rows="3" */
}

/* 响应式样式 */
@media (max-width: 768px) {
    .login-page__logo img {
        width: 80%;
    }
}

/* 深色模式下的页面特定样式 */
[data-theme="dark"] .about-page {
    color: var(--text-primary);
}

/* RTL 支持 */

/* 默认 LTR 布局 */
html[dir="ltr"] #audio_player {
    float: right;
}

/* RTL 布局支持 */
html[dir="rtl"] {
    /* 文本区域 */
    textarea {
        direction: rtl;
        text-align: right;
    }

    /* 工具按钮 */
    .tool-buttons {
        text-align: left;
    }

    /* 通知 */
    .notification {
        right: auto;
        left: 20px;
    }

    /* 音频播放器 */
    #audio_player {
        float: left;
    }
}

/* 阿拉伯语文本 */
.text-rtl {
    direction: rtl;
    font-family: "Amiri", serif;
}

/* 录音工具条响应式样式 */
@media (max-width: 375px) {
    #recording_timer {
        font-size: 0.875rem;
        margin-right: 0.25rem !important;
    }
    
    #recording_status_icon {
        font-size: 0.875rem;
        margin-right: 0.25rem !important;
    }
}

/* iPhone 15 Pro 竖屏适配 */
@media screen and (device-width: 390px) and (device-height: 844px) {
    /* 调整录音工具条在小屏幕上的样式 */
    #recording_timer {
        font-size: 0.875rem;
        margin-right: 0.25rem !important;
    }
    
    #recording_status_icon {
        font-size: 0.875rem;
        margin-right: 0.25rem !important;
    }

    /* 调整按钮大小 */
    .btn-lg {
        padding: 0.375rem 0.75rem;
        font-size: 0.9rem;
    }

    /* 调整输入框和文本区域 */
    textarea {
        font-size: 1rem;
        line-height: 1.4;
    }
}

/* iPhone 15 Pro 横屏适配 */
@media screen and (device-width: 844px) and (device-height: 390px) {
    /* 横屏时调整布局 */
    .container {
        max-width: 800px;
    }

    /* 调整按钮布局 */
    .tool-buttons {
        display: flex;
        justify-content: flex-end;
        gap: 0.5rem;
    }
}

/* iPhone 设备适配 */

/* iPhone X/XS (375 x 812) */
@media screen and (device-width: 375px) and (device-height: 812px) {
    /* 调整录音工具条 */
    #recording_timer, #recording_status_icon {
        font-size: 0.875rem;
        margin-right: 0.25rem !important;
    }
    
    /* 调整按钮大小 */
    .btn-lg {
        padding: 0.375rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* 调整输入框 */
    textarea {
        font-size: 1rem;
        line-height: 1.4;
    }
}

/* iPhone XR (414 x 896) */
@media screen and (device-width: 414px) and (device-height: 896px) {
    .container {
        padding: 0.75rem;
    }
    
    .card {
        padding: 1rem !important;
    }
}

/* iPhone 8 Plus (414 x 736) */
@media screen and (device-width: 414px) and (device-height: 736px) {
    .container {
        padding: 0.75rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
    }
}

/* iPhone 12/12 Pro (390 x 844) */
@media screen and (device-width: 390px) and (device-height: 844px) {
    .container {
        padding: 0.75rem;
    }
    
    .tool-buttons {
        gap: 0.5rem;
    }
}

/* iPhone 12 Pro Max (428 x 926) */
@media screen and (device-width: 428px) and (device-height: 926px) {
    .container {
        max-width: 100%;
        padding: 1rem;
    }
}

/* iPhone 13/13 Pro (390 x 844) - 与 12/12 Pro 相同 */
/* 使用上面的 12/12 Pro 的媒体查询 */

/* iPhone 13 Pro Max (428 x 926) - 与 12 Pro Max 相同 */
/* 使用上面的 12 Pro Max 的媒体查询 */

/* iPhone 14/14 Pro (393 x 852) */
@media screen and (device-width: 393px) and (device-height: 852px) {
    .container {
        padding: 0.75rem;
    }
    
    .btn-lg {
        padding: 0.375rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* iPhone 14 Pro Max (430 x 932) */
@media screen and (device-width: 430px) and (device-height: 932px) {
    .container {
        max-width: 100%;
        padding: 1rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
}

/* iPhone 15/15 Pro (393 x 852) - 与 14/14 Pro 相同 */
/* 使用上面的 14/14 Pro 的媒体查询 */

/* iPhone 15 Pro Max (430 x 932) - 与 14 Pro Max 相同 */
/* 使用上面的 14 Pro Max 的媒体查询 */

/* iPhone 16/16 Pro (预计尺寸，可能需要后续调整) */
@media screen and (min-width: 393px) and (max-width: 430px) and (min-height: 852px) {
    .container {
        padding: 0.75rem;
    }
    
    .btn-lg {
        padding: 0.375rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
}

/* 横屏模式通用适配 */
@media screen and (orientation: landscape) and (max-height: 932px) {
    .container {
        max-width: 800px;
        padding: 0.5rem;
    }
    
    .tool-buttons {
        display: flex;
        justify-content: flex-end;
        gap: 0.5rem;
    }
    
    .card {
        margin-bottom: 0.5rem;
    }
    
    #origin_message {
        min-height: 3.5em;
    }
}

/* 动态刘海屏适配 */
@supports (padding-top: env(safe-area-inset-top)) {
    .container {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* 图片预览界面 */
.image-preview-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-preview-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
}

.image-preview-content {
    position: relative;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
    max-width: 90%;
    max-height: 90%;
}

.image-preview-wrapper {
    background-color: var(--background-color);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.preview-image {
    max-width: 100%;
    max-height: calc(90vh - 100px);
    object-fit: contain;
    border-radius: 4px;
}

.image-preview-actions {
    display: flex;
    gap: 20px;
}

.image-preview-actions button {
    padding: 10px 20px;
    font-size: 1.2em;
    min-width: 120px;
}

/* Token Modal */
.token-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.token-modal-content {
    position: fixed;
    left: 50%;
    bottom: -100%;  /* 初始位置在屏幕下方 */
    transform: translateX(-50%);
    background-color: var(--background-color);
    padding: 2rem;
    border-radius: 1rem 1rem 0 0;
    width: 90%;
    max-width: 500px;
    transition: bottom 0.3s ease-in-out;
}

.token-modal.show .token-modal-content {
    bottom: 0;  /* 显示时滑到底部 */
}

/* 适配深色模式 */
[data-theme="dark"] .token-modal-content {
    background-color: var(--background-color);
    color: var(--text-color);
}

/* iPhone 12 Pro Max 的媒体查询 */
@media screen and (min-width: 393px) and (max-width: 430px) and (min-height: 852px),
       screen and (width: 428px) and (height: 926px),
       screen and (-webkit-device-pixel-ratio: 3) and (device-width: 428px) and (device-height: 926px) {
    .container {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
    /* 主要操作按钮（录音和上传）*/
    .btn-lg {
        padding: 0.5rem 1rem !important;
        font-size: 1.25rem !important;
        border-radius: 0.4rem !important;
    }
    /* 辅助按钮（取消和提交）- 仅在非 btn-lg 状态下应用 */
    #cancel_recording_button:not(.btn-lg),
    #submit_recording_button:not(.btn-lg) {
        padding: 0.4rem 0.8rem;
        font-size: 1rem;
    }
    .card {
        padding: 1rem !important;
    }
}

/* 针对 PWA 模式的额外样式 */
@media all and (display-mode: standalone) {
    /* 主要操作按钮（录音和上传）*/
    .btn-lg {
        padding: 0.5rem 1rem !important;
        font-size: 1.25rem !important;
        border-radius: 0.4rem !important;
    }
    /* 辅助按钮（取消和提交）- 仅在非 btn-lg 状态下应用 */
    #cancel_recording_button:not(.btn-lg),
    #submit_recording_button:not(.btn-lg) {
        padding: 0.4rem 0.8rem;
        font-size: 1rem;
    }
} 