/* 自定义字体 */
@font-face {
    font-family: 'HAT';
    src: url('hat.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'HAT', Arial, sans-serif;
}

/* 双向文本支持 */
.uyghur-text {
    direction: rtl;
    unicode-bidi: bidi-override;
    text-align: right;
}

/* 数字、中文、英文等保持从左到右显示 */
.ltr-text {
    direction: ltr;
    unicode-bidi: bidi-override;
    text-align: left;
}

/* 自动检测文本方向 */
.auto-text-direction {
    direction: rtl;
    text-align: right;
}

.auto-text-direction :not(span.ltr-text) {
    direction: rtl;
    text-align: right;
}

.auto-text-direction span.ltr-text {
    direction: ltr;
    text-align: left;
    display: inline-block;
    unicode-bidi: bidi-override;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    display: flex;
    flex-direction: row;
    overflow-x: hidden;
}

/* 侧边栏样式 */
.sidebar {
    width: 250px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 250, 255, 0.95) 100%);
    border-right: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 
        2px 0 20px rgba(0, 0, 0, 0.15),
        inset 1px 0 0 rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(12px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 12px 12px 0;
    overflow: hidden;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.sidebar-header {
    padding: 30px 20px 25px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 
        0 4px 15px rgba(102, 126, 234, 0.4),
        inset 0 -1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
}

.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 1.2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sidebar-menu {
    padding: 15px 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-footer {
    padding: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    background: radial-gradient(circle at top left, rgba(129, 140, 248, 0.15), transparent 55%),
                radial-gradient(circle at bottom right, rgba(196, 181, 253, 0.18), transparent 55%),
                rgba(248, 250, 252, 0.96);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.18);
}

.stats-box {
    padding: 12px 18px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(239, 246, 255, 0.98) 100%);
    display: flex;
    flex-direction: column;
    gap: 6px;
    backdrop-filter: blur(10px);
}

.stats-box::before {
    content: '运行统计';
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 2px;
}

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 12px;
    color: #6b7280;
}

.stat-row:last-child {
    margin-bottom: 0;
}

.stat-label {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.9;
}

.stat-value {
    font-weight: 700;
    color: #4f46e5;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
}

.developer-notice {
    padding: 10px 16px 12px;
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
    line-height: 1.4;
    border-top: 1px dashed rgba(148, 163, 184, 0.35);
}

/* 滚动条美化 */
.sidebar-menu::-webkit-scrollbar {
    width: 7px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: rgba(226, 232, 240, 0.5);
    border-radius: 3.5px;
    margin: 10px 0;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #cbd5e0 0%, #94a3b8 100%);
    border-radius: 3.5px;
    transition: background 0.3s ease;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
}

.sidebar-btn {
    display: flex;
    align-items: center;
    padding: 18px 22px;
    color: #4a5568;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
    position: relative;
    overflow: hidden;
    gap: 12px;
}

/* 当前页面激活状态 */
.sidebar-btn.active {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.08) 100%);
    color: #667eea;
    border-left-color: #667eea;
    box-shadow: inset 3px 0 0 #667eea;
}

.sidebar-btn.active::before {
    width: 100%;
}

.sidebar-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.1) 100%);
    transition: width 0.3s ease;
    z-index: -1;
}

.sidebar-btn:hover::before {
    width: 100%;
}

.sidebar-btn:hover {
    background: transparent;
    color: #667eea;
    border-left-color: #667eea;
    padding-left: 26px;
    transform: translateX(6px);
    box-shadow: inset 3px 0 0 #667eea;
}

/* 按钮图标容器 */
.sidebar-btn .icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-btn .text {
    flex: 1;
    transition: all 0.3s ease;
}

/* 侧边栏图标样式 */
.sidebar-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-btn:hover svg {
    transform: scale(1.15) rotate(3deg);
}

.sidebar-btn.active svg {
    stroke: #667eea;
    transform: scale(1.1);
}

/* 侧边栏折叠按钮 */
.sidebar-toggle {
    position: fixed;
    left: 250px;
    top: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    transform: scale(1.1) rotate(360deg);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* 侧边栏折叠状态 */
body.sidebar-collapsed .sidebar {
    width: 0;
    transform: translateX(-100%);
    overflow: hidden;
    box-shadow: none;
}

body.sidebar-collapsed .sidebar-header {
    padding: 25px 0;
    text-align: center;
}

body.sidebar-collapsed .sidebar-header h3 {
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.sidebar-collapsed .sidebar-btn {
    justify-content: center;
    padding: 18px 10px;
}

body.sidebar-collapsed .sidebar-btn .text {
    display: none;
    width: 0;
    overflow: hidden;
}

body.sidebar-collapsed .sidebar-btn .icon {
    width: 24px;
    height: 24px;
}

body.sidebar-collapsed .sidebar-footer {
    display: none;
}

body.sidebar-collapsed .sidebar-toggle {
    left: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 主内容区样式 */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 30px;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
    background-attachment: fixed;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: calc(100% - 250px);
    box-sizing: border-box;
    float: right;
}

/* 侧边栏折叠状态下的主内容区 */
body.sidebar-collapsed .main-content {
    margin-left: 0;
    width: 100%;
}

.container {
    max-width: 950px;
    margin: 0 auto;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 250, 255, 0.95) 100%);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.2),
        0 10px 30px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.container:hover {
    box-shadow: 
        0 25px 70px rgba(0, 0, 0, 0.25),
        0 15px 40px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
}

/* 响应式设计 - 手机端适配 */
@media (max-width: 768px) {
    .sidebar {
        width: 260px;
        transform: translateX(-100%);
        z-index: 1050;
        box-shadow: 3px 0 20px rgba(0, 0, 0, 0.3);
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px 10px;
        transition: none;
    }
    
    .sidebar-toggle {
        left: 15px;
        z-index: 1060;
    }
    
    body.sidebar-expanded .sidebar {
        transform: translateX(0);
        position: fixed;
        height: 100vh;
    }
    
    /* 侧边栏展开时，主内容区添加半透明遮罩 */
    body.sidebar-expanded::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1040;
    }
    
    .button-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        width: 100%;
    }
    
    .container {
        padding: 25px 20px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.4rem;
    }

    .stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-value {
        font-size: 1.8rem;
    }
    
    .sidebar-btn {
        padding: 16px 18px;
        font-size: 14px;
        gap: 10px;
    }
    
    .sidebar-btn .icon {
        width: 20px;
        height: 20px;
    }
    
    .sidebar-header {
        padding: 25px 15px 20px;
    }
    
    .sidebar-header h3 {
        font-size: 1.25rem;
    }
}

/* 标题样式 */
h1 {
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 40px;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

h2 {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 40px 0 25px;
    font-size: 1.6rem;
    font-weight: 700;
    border-bottom: 2px solid rgba(102, 126, 234, 0.3);
    padding-bottom: 12px;
    letter-spacing: 0.5px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 30px;
    position: relative;
}

label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #4a5568;
    font-size: 15px;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

textarea {
    width: 100%;
    padding: 18px 20px;
    border: 2px solid rgba(148, 163, 184, 0.3);
    border-radius: 12px;
    font-size: 15px;
    resize: vertical;
    min-height: 180px;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    color: #2d3748;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 
        0 0 0 3px rgba(102, 126, 234, 0.15),
        inset 0 2px 4px rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

/* 按钮组样式 */
.button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 40px;
    justify-content: center;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    color: #4a5568;
    border: 2px solid rgba(148, 163, 184, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #edf2f7 0%, #e2e8f0 100%);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: rgba(102, 126, 234, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(72, 187, 120, 0.5);
}

/* 统计信息样式 */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 30px 0;
}

.stat-item {
    background: #f7fafc;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #e2e8f0;
}

.stat-label {
    display: block;
    font-size: 14px;
    color: #718096;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #4a5568;
}

.stat-value.valid {
    color: #48bb78;
}

.stat-value.invalid {
    color: #f56565;
}

/* 结果列表样式 */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.result-item {
    padding: 20px;
    border-radius: 10px;
    border-left: 5px solid;
    background: #f7fafc;
    transition: transform 0.3s ease;
}

.result-item:hover {
    transform: translateX(5px);
}

.result-item.valid {
    border-left-color: #48bb78;
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.1) 0%, rgba(56, 161, 105, 0.05) 100%);
}

.result-item.invalid {
    border-left-color: #f56565;
    background: linear-gradient(135deg, rgba(245, 101, 101, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
}

.wxv-code {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #4a5568;
}

.status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.result-item.valid .status {
    background: #48bb78;
    color: white;
}

.result-item.invalid .status {
    background: #f56565;
    color: white;
}

.details {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.details p {
    margin-bottom: 8px;
    font-size: 14px;
}

.details p:last-child {
    margin-bottom: 0;
}

.details strong {
    color: #4a5568;
}

/* 超小屏幕响应式 */
@media (max-width: 480px) {
    /* 侧边栏在小屏幕上调整宽度，但保持左侧显示 */
    .sidebar {
        width: 160px;
        border-radius: 0 8px 8px 0;
    }
    
    .sidebar-header h3 {
        font-size: 1.2rem;
    }
}

/* 极小屏幕响应式（如320px以下） */
@media (max-width: 360px) {
    /* 确保在极小屏幕上侧边栏默认隐藏 */
    .sidebar {
        width: 240px;
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
        padding: 8px 3px;
    }
    
    /* 容器样式进一步优化 */
    .container {
        padding: 15px 10px;
        border-radius: 12px;
    }
    
    /* 按钮组优化 */
    .button-group {
        gap: 10px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* 进度条样式 */
.progress-container {
    margin: 30px 0;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) inset;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 200% 100%;
    border-radius: 6px;
    transition: width 0.3s ease, background-position 0.5s ease;
    width: 0%;
    animation: shimmer 1.5s infinite;
}

/* 添加进度条闪烁动画 */
@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 提示框样式 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.toast.error {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
}
