* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --bg-color: #ffffff;
    --text-color: #212529;
    --input-bg: #ffffff;
    --input-border: #ced4da;
    --card-bg: #ffffff;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

[data-theme="blue"] {
    --primary-color: #007bff;
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --input-bg: #ffffff;
    --input-border: #ced4da;
    --card-bg: #ffffff;
}

[data-theme="dark"] {
    --primary-color: #17a2b8;
    --bg-color: #212529;
    --text-color: #ffffff;
    --input-bg: #343a40;
    --input-border: #495057;
    --card-bg: #343a40;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
}

[data-theme="green"] {
    --primary-color: #28a745;
    --bg-color: #f1f8e9;
    --text-color: #2e7d32;
    --input-bg: #ffffff;
    --input-border: #81c784;
    --card-bg: #ffffff;
}

[data-theme="purple"] {
    --primary-color: #6f42c1;
    --bg-color: #f8f5ff;
    --text-color: #4a154b;
    --input-bg: #ffffff;
    --input-border: #b794f6;
    --card-bg: #ffffff;
}

[data-theme="orange"] {
    --primary-color: #fd7e14;
    --bg-color: #fff8f0;
    --text-color: #c65d00;
    --input-bg: #ffffff;
    --input-border: #ffb366;
    --card-bg: #ffffff;
}

[data-theme="pink"] {
    --primary-color: #e83e8c;
    --bg-color: #fdf2f8;
    --text-color: #9d174d;
    --input-bg: #ffffff;
    --input-border: #f8bbd9;
    --card-bg: #ffffff;
}

[data-theme="red"] {
    --primary-color: #dc3545;
    --bg-color: #fef2f2;
    --text-color: #991b1b;
    --input-bg: #ffffff;
    --input-border: #fca5a5;
    --card-bg: #ffffff;
}

[data-theme="white"] {
    --primary-color: #6c757d;
    --bg-color: #ffffff;
    --text-color: #212529;
    --input-bg: #f8f9fa;
    --input-border: #e9ecef;
    --card-bg: #f8f9fa;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
}

[data-theme="darkblue"] {
    --primary-color: #0056b3;
    --bg-color: #f0f4f8;
    --text-color: #1e3a8a;
    --input-bg: #ffffff;
    --input-border: #93c5fd;
    --card-bg: #ffffff;
}

[data-theme="yellow"] {
    --primary-color: #ffc107;
    --bg-color: #fffbeb;
    --text-color: #92400e;
    --input-bg: #ffffff;
    --input-border: #fde68a;
    --card-bg: #ffffff;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    transition: all 0.3s ease;
}

.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    border: 1px solid var(--input-border);
    transition: all 0.3s ease;
}

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

.auth-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 2rem;
    font-weight: 600;
}

.auth-header p {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-input {
    width: 100%;
    padding: 1rem;
    border: 3px solid var(--input-border);
    border-radius: 8px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    min-height: 48px; /* 确保触摸友好的最小高度 */
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    border-width: 3px;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.15), 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.form-input:hover:not(:focus) {
    border-color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* 通用输入框和选择框样式优化 */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
    padding: 0.875rem 1rem;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    min-height: 44px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15), 0 4px 8px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

input[type="text"]:hover:not(:focus),
input[type="email"]:hover:not(:focus),
input[type="password"]:hover:not(:focus),
input[type="url"]:hover:not(:focus),
input[type="search"]:hover:not(:focus),
input[type="date"]:hover:not(:focus),
input[type="datetime-local"]:hover:not(:focus),
textarea:hover:not(:focus),
select:hover:not(:focus) {
    border-color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* 特殊处理textarea */
textarea {
    min-height: 80px;
    resize: vertical;
}

/* 特殊处理select */
select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
    appearance: none;
}

/* 筛选器输入框 - 特别优化 */
.filter-input, .filter-select {
    padding: 0.75rem 1rem !important;
    border: 2px solid var(--input-border) !important;
    border-radius: 8px !important;
    background-color: var(--input-bg) !important;
    color: var(--text-color) !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.3s ease !important;
    min-height: 42px !important;
}

.filter-input:focus, .filter-select:focus {
    outline: none !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15), 0 4px 8px rgba(0, 0, 0, 0.12) !important;
    transform: translateY(-1px) !important;
}

.filter-input:hover:not(:focus), .filter-select:hover:not(:focus) {
    border-color: var(--primary-color) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
}

/* 占位符样式优化 */
.form-input::placeholder,
input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="url"]::placeholder,
input[type="search"]::placeholder,
textarea::placeholder {
    color: #6c757d;
    opacity: 0.8;
    font-weight: 400;
    font-style: italic;
}

/* 当输入框处于焦点时，占位符变得更淡 */
.form-input:focus::placeholder,
input[type="text"]:focus::placeholder,
input[type="email"]:focus::placeholder,
input[type="password"]:focus::placeholder,
input[type="url"]:focus::placeholder,
input[type="search"]:focus::placeholder,
textarea:focus::placeholder {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.btn {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover {
    background-color: color-mix(in srgb, var(--primary-color) 85%, black);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
    margin-top: 0.5rem;
}

.btn-secondary:hover {
    background-color: color-mix(in srgb, var(--secondary-color) 85%, black);
}

.btn-link {
    background: none;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    width: auto;
    display: inline-block;
}

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

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--input-border);
}

.auth-links p {
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.theme-selector {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 99999 !important;
    /* 确保是定位上下文 */
}

.theme-selector .theme-btn {
    position: relative !important;
}

.theme-btn {
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.theme-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* 黑色主题下的主题按钮特殊样式 */
[data-theme="dark"] .theme-btn {
    background: var(--card-bg);
    border: 2px solid #ffffff;
    color: #ffffff;
}

[data-theme="dark"] .theme-btn:hover {
    background-color: #ffffff;
    color: #212529;
}

.theme-dropdown {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    right: 0 !important;
    left: auto !important;
    background: var(--card-bg) !important;
    border: 1px solid var(--input-border) !important;
    border-radius: 6px !important;
    box-shadow: var(--shadow) !important;
    min-width: 120px !important;
    max-height: 400px !important;
    overflow-y: auto !important;
    display: none !important;
    z-index: 10001 !important;
}

.theme-dropdown.show {
    display: block !important;
    visibility: visible !important;
}

.theme-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--input-border);
    transition: background-color 0.3s ease;
}

.theme-option:last-child {
    border-bottom: none;
}

.theme-option:hover {
    background-color: var(--light-color);
}

.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    font-weight: 500;
}

.alert-success {
    background-color: color-mix(in srgb, var(--success-color) 15%, white);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.alert-danger {
    background-color: color-mix(in srgb, var(--danger-color) 15%, white);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading .btn {
    position: relative;
}

.loading .btn::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

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

/* Dashboard & Tools Styles */
.header {
    margin-bottom: 2rem;
}

.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 2px solid var(--primary-color);
}

.nav-left .logo {
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: bold;
    margin: 0;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    color: var(--text-color);
    font-size: 0.9rem;
}

.logout-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background-color: color-mix(in srgb, var(--danger-color) 85%, black);
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.page-header h2 {
    color: var(--text-color);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 0 1rem;
    justify-items: center;
}

.tool-card {
    background: var(--card-bg);
    border: 2px solid var(--input-border);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 320px;
}

.tool-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transform: translateY(-5px);
}

.tool-image {
    margin-bottom: 1.5rem;
}

.tool-icon {
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 1rem;
}

.tool-info {
    text-align: center;
}

.tool-name {
    color: var(--text-color);
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.tool-description {
    color: var(--secondary-color);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
        padding: 0 0.5rem;
    }

    .tool-card {
        padding: 1.5rem;
    }

    .nav-bar {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .page-header h2 {
        font-size: 2rem;
    }
}

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

    .auth-card {
        padding: 1.5rem;
        margin: 0 0.5rem;
    }

    .theme-selector {
        top: 10px;
        right: 10px;
    }

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

    .tool-name {
        font-size: 1.1rem;
    }
}

/* 微信登录样式 */
.wechat-login-section {
    margin-bottom: 2rem;
}

.qr-code-container {
    text-align: center;
    margin-bottom: 1.5rem;
}

.qr-image {
    max-width: 200px;
    width: 100%;
    height: auto;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.qr-placeholder {
    background: var(--light-color);
    border: 2px dashed var(--input-border);
    border-radius: 12px;
    padding: 2rem 1rem;
    margin-bottom: 1rem;
}

.qr-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.qr-placeholder p {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.qr-placeholder small {
    color: var(--secondary-color);
    font-size: 0.85rem;
}

.email-login-section {
    margin-top: 2rem;
    border-top: 1px solid var(--input-border);
    padding-top: 1rem;
}

.login-option-toggle {
    cursor: pointer;
    color: var(--secondary-color);
    font-size: 0.9rem;
    text-align: center;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    user-select: none;
}

.login-option-toggle:hover {
    color: var(--primary-color);
    background-color: var(--light-color);
}

.email-login-section[open] .login-option-toggle {
    margin-bottom: 1rem;
}

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

.btn-secondary:hover {
    background-color: color-mix(in srgb, var(--secondary-color) 85%, black);
}

/* 验证码输入框优化 */
#verifyCode {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 0.2rem;
}

#verifyCode:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

/* 响应式优化 */
@media (max-width: 480px) {
    .qr-placeholder {
        padding: 1.5rem 0.5rem;
    }

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

/* 微信绑定相关样式 */
.btn-success {
    background-color: #28a745;
    color: white;
    border: none;
}

.btn-success:hover {
    background-color: #218838;
    transform: translateY(-1px);
}

.info-box {
    background-color: var(--card-bg);
    border: 2px solid #17a2b8;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.info-box h4 {
    margin-top: 0;
    color: #17a2b8;
}

.info-box ol {
    margin: 12px 0;
    padding-left: 20px;
}

.info-box li {
    margin: 8px 0;
}

.info-box code {
    background-color: #f8f9fa;
    color: #e83e8c;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.highlight {
    background-color: #fff3cd;
    color: #856404;
    padding: 8px;
    border-radius: 4px;
    border-left: 4px solid #ffc107;
    margin-top: 12px;
}

.wechat-actions {
    margin-top: 12px;
}