/* ============================================================================
   浅色主题 (Light Theme) - 默认主题
   ============================================================================ */
:root, .light-theme {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --secondary-color: #0891b2;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --bg-hover-color: #f3f4f6;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --success-color: #10b981;
    --info-color: #3b82f6;
    --radius: 0.5rem;
    --transition: all 0.2s ease;
}

/* ============================================================================
   深色主题 (Dark Theme)
   ============================================================================ */
.dark-theme {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #06b6d4;
    --text-color: #f9fafb;
    --text-light: #d1d5db;
    --bg-color: #111827;
    --bg-secondary: #1f2937;
    --border-color: #374151;
    --bg-hover-color: #2d3748;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --error-color: #f87171;
    --warning-color: #fbbf24;
    --success-color: #34d399;
    --info-color: #60a5fa;
    --radius: 0.5rem;
    --transition: all 0.2s ease;
}

/* 主题切换按钮样式 */
#themeToggle i.fa-sun {
    display: none;
}

.dark-theme #themeToggle i.fa-moon {
    display: none;
}

.dark-theme #themeToggle i.fa-sun {
    display: inline-block;
}

/* 工具卡片在深色主题下的调整 */
.dark-theme .tool-card {
    background-color: var(--bg-secondary);
}

.dark-theme .category-card {
    background-color: var(--bg-secondary);
}

/* 输入框在深色主题下的样式 */
.dark-theme input,
.dark-theme textarea,
.dark-theme select {
    background-color: var(--bg-secondary);
    color: var(--text-color);
    border-color: var(--border-color);
}

.dark-theme input:focus,
.dark-theme textarea:focus,
.dark-theme select:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* 工具页面特定样式 */
.tool-page {
    padding: 2rem 0;
}

.tool-container {
    max-width: 800px;
    margin: 0 auto;
}

.tool-header {
    margin-bottom: 2rem;
    text-align: center;
}

.tool-content {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.tool-section {
    margin-bottom: 2rem;
}

.tool-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* 表单元素样式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: var(--transition);
}

textarea.form-control {
    min-height: 150px;
    resize: vertical;
    font-family: 'Courier New', monospace;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* 按钮组 */
.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* 结果区域 */
.result-area {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.result-content {
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-break: break-all;
    padding: 1rem;
    background-color: var(--bg-color);
    border-radius: var(--radius);
    max-height: 400px;
    overflow-y: auto;
}

/* 颜色预览 */
.color-preview {
    width: 50px;
    height: 50px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-right: 1rem;
}

.color-info {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

/* 图像预览 */
.image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin: 1rem 0;
}

/* 标签和徽章 */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--bg-secondary);
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* 工具说明 */
.tool-instructions {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-top: 2rem;
}

.tool-instructions h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* 工具页面的响应式调整 */
@media (max-width: 768px) {
    .tool-content {
        padding: 1rem;
    }
    
    .color-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .color-preview {
        margin-bottom: 0.5rem;
    }
}

/* 在css/themes.css末尾添加以下样式 */

/* 字符计数器特定样式补充 */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.stat-card.highlight::before {
    height: 5px;
}

/* 文本预览区域的滚动条样式 */
.text-preview::-webkit-scrollbar {
    width: 8px;
}

.text-preview::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.text-preview::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.text-preview::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 表格响应式设计 */
.table-container {
    overflow-x: auto;
    margin-bottom: 1rem;
}

/* 加载动画 */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 高亮动画 */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(79, 70, 229, 0); }
    100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* 在css/themes.css末尾添加单位转换器特定样式 */

/* 单位转换器特定样式补充 */
.category-info {
    background-color: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.category-info h5 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.category-info p {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

/* 输入框数字选择器样式 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    height: 1.5em;
    opacity: 0.5;
}

input[type="number"]:hover::-webkit-inner-spin-button,
input[type="number"]:hover::-webkit-outer-spin-button {
    opacity: 1;
}

/* 单位选择下拉框样式增强 */
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

.dark-theme select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23d1d5db' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
}

/* 单位卡片焦点状态 */
.unit-card:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* 响应式表格容器 */
.table-container {
    overflow-x: auto;
    margin: 1rem 0;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

/* 工具说明中的列表样式 */
.tool-instructions ol,
.tool-instructions ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.tool-instructions li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* 按钮组响应式调整 */
@media (max-width: 768px) {
    .btn-group {
        flex-wrap: wrap;
    }
    
    .btn-group .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* 单位图标动画 */
@keyframes iconPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.unit-icon.animate {
    animation: iconPulse 0.5s ease;
}


/* 在css/themes.css末尾添加图片尺寸调整器特定样式 */

/* 图片尺寸调整器特定样式补充 */
.size-input input[type="number"] {
    -moz-appearance: textfield;
}

.size-input input[type="number"]::-webkit-inner-spin-button,
.size-input input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 自定义复选框样式 */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 3px;
    background-color: var(--bg-color);
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 0.5rem;
}

input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:hover {
    border-color: var(--primary-color);
}

/* 范围输入样式增强 */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input[type="range"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

input[type="range"]:disabled::-webkit-slider-thumb {
    cursor: not-allowed;
}

/* 图片加载动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.image-preview {
    animation: fadeIn 0.3s ease;
}

/* 按钮加载状态 */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn i.fa-spinner {
    animation: spin 1s linear infinite;
}

/* 工具说明中的小标题 */
.tool-instructions h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.tool-instructions p {
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* 错误消息图标 */
.error-message i {
    margin-right: 0.5rem;
}

/* 上传区域内的文件输入标签样式 */
.file-input-label {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1rem;
}

.file-input-label:hover {
    background-color: var(--primary-dark);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .size-controls {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .size-separator {
        display: none;
    }
    
    .resize-options {
        grid-template-columns: 1fr;
    }
    
    .ratio-presets {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
    }
    
    .ratio-preset {
        white-space: nowrap;
    }
    
    .dimension-presets {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* 暗色主题调整 */
.dark-theme input[type="checkbox"] {
    background-color: var(--bg-secondary);
}

.dark-theme input[type="range"]::-webkit-slider-thumb {
    border-color: var(--bg-color);
}

/* 图片信息网格调整 */
@media (max-width: 480px) {
    .image-info {
        flex-wrap: wrap;
    }
    
    .info-item {
        min-width: 50%;
        margin-bottom: 0.5rem;
    }
}

/* 在css/themes.css末尾添加URL编码器/解码器特定样式 */

/* URL编码器/解码器特定样式补充 */
.highlight {
    animation: highlightPulse 1s ease;
}

@keyframes highlightPulse {
    0% { background-color: var(--bg-color); }
    50% { background-color: rgba(79, 70, 229, 0.1); }
    100% { background-color: var(--bg-color); }
}

/* 文本输入框自动调整高度 */
.text-input {
    resize: vertical;
    min-height: 120px;
    max-height: 500px;
    transition: height 0.2s ease;
}

/* 单选按钮样式 */
input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background-color: var(--bg-color);
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 0.5rem;
}

input[type="radio"]:checked {
    border-color: var(--primary-color);
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
}

input[type="radio"]:hover {
    border-color: var(--primary-color);
}

/* 表格容器滚动条 */
.table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.table-container::-webkit-scrollbar {
    width: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 按钮组内的图标按钮 */
.btn-icon {
    width: 36px;
    height: 36px;
}

/* 历史记录操作标签 */
.history-operation.encode {
    background-color: var(--primary-color);
}

.history-operation.decode {
    background-color: var(--secondary-color);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .url-tabs {
        flex-wrap: wrap;
    }
    
    .url-tab {
        flex: 1 0 50%;
        justify-content: center;
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .url-tab-badge {
        display: none;
    }
    
    .batch-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .batch-item-number {
        margin-bottom: 0.5rem;
    }
    
    .batch-item-content {
        width: 100%;
    }
    
    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .history-content {
        width: 100%;
    }
    
    .history-time {
        align-self: flex-end;
    }
}

/* 暗色主题调整 */
.dark-theme input[type="radio"] {
    background-color: var(--bg-secondary);
}

.dark-theme .example-card:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.dark-theme .history-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* 代码字体优化 */
code {
    font-family: 'Courier New', monospace;
    background-color: var(--bg-secondary);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    color: var(--primary-color);
}

/* 工具说明中的代码块 */
.tool-instructions code {
    display: inline-block;
    margin: 0.25rem 0;
}

/* 标签页内容动画 */
.url-content {
    animation: fadeIn 0.3s ease;
}

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

/* 输入框组标签样式 */
.input-label {
    font-weight: 600;
    color: var(--text-color);
}

.input-label .character-count {
    font-weight: normal;
}

/* 示例卡片内的代码 */
.example-original,
.example-encoded {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
}

/* 在css/themes.css末尾添加JSON格式化器特定样式 */

/* JSON格式化器特定样式补充 */
.json-highlight span {
    display: inline;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 滚动条样式 */
.json-display::-webkit-scrollbar,
.tree-container::-webkit-scrollbar,
.lint-issues::-webkit-scrollbar,
.history-items::-webkit-scrollbar {
    width: 8px;
}

.json-display::-webkit-scrollbar-track,
.tree-container::-webkit-scrollbar-track,
.lint-issues::-webkit-scrollbar-track,
.history-items::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.json-display::-webkit-scrollbar-thumb,
.tree-container::-webkit-scrollbar-thumb,
.lint-issues::-webkit-scrollbar-thumb,
.history-items::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.json-display::-webkit-scrollbar-thumb:hover,
.tree-container::-webkit-scrollbar-thumb:hover,
.lint-issues::-webkit-scrollbar-thumb:hover,
.history-items::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 代码块样式 */
.json-minified {
    font-size: 12px;
    line-height: 1.4;
}

/* 树视图样式增强 */
.json-node {
    position: relative;
    padding-left: 1rem;
}

.json-node::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: var(--border-color);
}

.json-node:last-child::before {
    height: 1em;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .json-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stat-item {
        margin-bottom: 0.5rem;
    }
    
    .conversion-tabs {
        flex-wrap: wrap;
    }
    
    .conversion-tab {
        flex: 1 0 33.333%;
        text-align: center;
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .examples-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .json-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .conversion-tab {
        flex: 1 0 50%;
    }
}

/* 暗色主题调整 */
.dark-theme .json-string {
    color: #50fa7b;
}

.dark-theme .json-number {
    color: #ff79c6;
}

.dark-theme .json-boolean {
    color: #8be9fd;
}

.dark-theme .json-null {
    color: #6272a4;
}

.dark-theme .json-key {
    color: #ffb86c;
}

/* 编辑器光标样式 */
.json-textarea {
    caret-color: var(--primary-color);
}

/* 高亮动画 */
.highlight {
    animation: highlightPulse 1s ease;
}

@keyframes highlightPulse {
    0% { background-color: var(--bg-color); }
    50% { background-color: rgba(79, 70, 229, 0.1); }
    100% { background-color: var(--bg-color); }
}

/* 错误行高亮 */
.json-error-line {
    background-color: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--error-color);
}

/* 代码检查图标 */
.lint-icon {
    color: var(--warning-color);
}

/* 输入框占位符样式 */
.json-textarea::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

/* 按钮加载状态 */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 工具说明中的代码块 */
.tool-instructions code {
    font-family: 'Courier New', monospace;
    background-color: var(--bg-secondary);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    color: var(--primary-color);
}

/* 历史项悬停效果 */
.history-item:hover {
    border-left: 3px solid var(--primary-color);
    padding-left: calc(0.75rem - 3px);
}

/* 转换标签页内容动画 */
.conversion-content {
    animation: fadeIn 0.3s ease;
}

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

/* 行号列样式 */
.json-line-numbers {
    font-variant-numeric: tabular-nums;
}

/* 编辑器容器阴影 */
.json-editor:focus-within {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
