/* ===================================
   闲鱼工具箱 - 现代化 UI 样式表
   =================================== */

/* CSS 变量定义 */
:root {
    /* 主色调 */
    --primary-color: #ff6b35;
    --primary-light: #ff8f66;
    --primary-dark: #e55a2b;

    /* 辅助色 */
    --accent-color: #4ecdc4;
    --accent-light: #7ee8e0;

    /* 背景色 */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #25253a;
    --bg-card-hover: #2d2d45;

    /* 文字颜色 */
    --text-primary: #ffffff;
    --text-secondary: #b0b0c8;
    --text-muted: #6b6b80;

    /* 边框颜色 */
    --border-color: #3a3a50;
    --border-light: #4a4a65;

    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(255, 107, 53, 0.3);

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* 过渡 */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* 字体 */
    --font-display: 'Space Grotesk', 'Noto Sans SC', sans-serif;
    --font-body: 'Noto Sans SC', 'Space Grotesk', sans-serif;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* 背景装饰 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(255, 107, 53, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(78, 205, 196, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(37, 37, 58, 0.5) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* ===================================
   顶部标题栏
   =================================== */
.header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    position: relative;
    overflow: hidden;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--primary-color));
    background-size: 200% 100%;
    animation: gradientFlow 3s ease infinite;
}

@keyframes gradientFlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    text-align: center;
}

.logo {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.logo-icon {
    font-size: 2.2rem;
    animation: bounce 2s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.1em;
}

/* ===================================
   选项卡导航栏
   =================================== */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.nav-tabs {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    border-bottom: 3px solid transparent;
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--primary-color);
    border-radius: 0 0 3px 3px;
    transition: width var(--transition-fast);
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 107, 53, 0.05);
}

.nav-item.active {
    color: var(--primary-color);
    background: rgba(255, 107, 53, 0.1);
}

.nav-item.active::before {
    width: 60%;
}

.nav-icon {
    font-size: 1.2rem;
}

/* ===================================
   主内容区
   =================================== */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* 选项卡内容区 */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

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

/* 占位符卡片 */
.placeholder-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.placeholder-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 107, 53, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(78, 205, 196, 0.08) 0%, transparent 40%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.placeholder-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.placeholder-card:hover::before {
    opacity: 1;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.placeholder-card h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.placeholder-card p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===================================
   底部版权栏
   =================================== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    text-align: center;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ===================================
   响应式设计
   =================================== */

/* 平板设备 */
@media (max-width: 768px) {
    .logo {
        font-size: 2rem;
    }

    .logo-icon {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.875rem;
    }

    .nav-item {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }

    .nav-icon {
        font-size: 1rem;
    }

    .main-content {
        padding: 1.5rem 0;
    }

    .content-wrapper {
        padding: 0 1rem;
    }

    .placeholder-card {
        padding: 3rem 1.5rem;
    }

    .placeholder-icon {
        font-size: 3rem;
    }

    .placeholder-card h2 {
        font-size: 1.5rem;
    }

    .placeholder-card p {
        font-size: 0.9rem;
    }
}

/* 移动设备 */
@media (max-width: 480px) {
    .header {
        padding: 1rem 0;
    }

    .logo {
        font-size: 1.5rem;
        gap: 0.5rem;
    }

    .logo-icon {
        font-size: 1.4rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .nav-tabs {
        gap: 0;
    }

    .nav-item {
        padding: 0.75rem 0.75rem;
        font-size: 0.8rem;
        flex-direction: column;
        gap: 0.25rem;
    }

    .nav-item .nav-text {
        font-size: 0.7rem;
    }

    .nav-item::before {
        height: 2px;
    }

    .tab-content {
        padding: 0 0.5rem;
    }

    .placeholder-card {
        padding: 2rem 1rem;
        border-radius: var(--radius-md);
    }

    .placeholder-icon {
        font-size: 2.5rem;
    }

    .placeholder-card h2 {
        font-size: 1.25rem;
    }

    .placeholder-card p {
        font-size: 0.85rem;
    }

    .footer {
        padding: 1rem 0;
    }

    .footer p {
        font-size: 0.75rem;
    }
}

/* 超宽屏幕 */
@media (min-width: 1400px) {
    :root {
        font-size: 18px;
    }

    .header-content,
    .nav-container,
    .content-wrapper,
    .footer-content {
        max-width: 1400px;
    }
}

/* 暗色模式增强（适配更多设备）*/
@media (prefers-color-scheme: dark) {
    body {
        color-scheme: dark;
    }
}

/* ===================================
   OCR 模块样式
   =================================== */

/* OCR 容器 */
.ocr-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* OCR 卡片 */
.ocr-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.ocr-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 107, 53, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(78, 205, 196, 0.06) 0%, transparent 40%);
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.ocr-card:hover::before {
    opacity: 1;
}

/* OCR 标题 */
.ocr-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

/* 上传区域 */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    transition: all var(--transition-fast);
    position: relative;
    z-index: 1;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(255, 107, 53, 0.05);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* 预览区域 */
.preview-area {
    text-align: center;
    position: relative;
    z-index: 1;
}

.preview-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    margin-bottom: 1rem;
    object-fit: contain;
}

/* 操作按钮区域 */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    position: relative;
    z-index: 1;
}

/* 加载区域 */
.loading-area {
    text-align: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.loading-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* 结果文本框 */
.result-textarea {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 1rem;
    resize: vertical;
    min-height: 120px;
    position: relative;
    z-index: 1;
}

.result-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.result-textarea::placeholder {
    color: var(--text-muted);
}

/* 结果操作按钮 */
.result-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    position: relative;
    z-index: 1;
}

/* Toast 提示 */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent-color);
    color: var(--bg-primary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

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

/* 错误卡片 */
.error-card {
    border-color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
}

.error-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.error-text {
    color: #ff6b7a;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

/* ===================================
   按钮样式（可复用）
   =================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    z-index: 1;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.btn-danger {
    background: #ff4757;
    color: white;
}

.btn-danger:hover {
    background: #ff6b7a;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* ===================================
   响应式 - OCR 模块
   =================================== */

@media (max-width: 768px) {
    .ocr-card {
        padding: 1.5rem;
    }

    .ocr-title {
        font-size: 1.1rem;
    }

    .preview-image {
        max-width: 250px;
        max-height: 250px;
    }

    .action-buttons,
    .result-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .ocr-card {
        padding: 1rem;
    }

    .upload-area {
        padding: 1.5rem 1rem;
    }

    .upload-icon {
        font-size: 2.5rem;
    }

    .preview-image {
        max-width: 200px;
        max-height: 200px;
    }

    .loading-spinner {
        width: 40px;
        height: 40px;
    }
}

/* ===================================
   语音转文字模块样式
   =================================== */

/* 语音转文字容器 */
.stt-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 子选项卡 */
.stt-tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.stt-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.stt-tab:hover {
    background: rgba(255, 107, 53, 0.05);
    color: var(--text-primary);
}

.stt-tab.active {
    background: var(--primary-color);
    color: white;
}

/* 子面板 */
.stt-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.stt-panel.active {
    display: block;
}

/* 语音转文字卡片 */
.stt-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.stt-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 107, 53, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(78, 205, 196, 0.06) 0%, transparent 40%);
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.stt-card:hover::before {
    opacity: 1;
}

.stt-info {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* 录音控制 */
.recording-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

/* 录音状态 */
.recording-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.status-dot {
    width: 12px;
    height: 12px;
    background: #ff4757;
    border-radius: 50%;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* 音频预览 */
.audio-preview {
    position: relative;
    z-index: 1;
}

#audio-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-align: center;
}

#audio-player {
    width: 100%;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
}

.audio-tip {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

/* ===================================
   响应式 - 语音转文字模块
   =================================== */

@media (max-width: 768px) {
    .stt-tabs {
        flex-direction: column;
    }

    .stt-card {
        padding: 1.5rem;
    }

    .recording-controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stt-card {
        padding: 1rem;
    }

    .stt-info {
        font-size: 0.875rem;
    }
}
