/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部 */
header {
    text-align: center;
    padding: 40px 0;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header .subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 工具卡片网格 */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px 0;
    flex: 1;
}

.tool-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    text-decoration: none;
    color: #333;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.tool-card.coming-soon {
    opacity: 0.6;
    cursor: default;
}

.tool-card.coming-soon:hover {
    transform: none;
    box-shadow: none;
}

.tool-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.tool-card h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #333;
}

.tool-card p {
    color: #666;
    font-size: 0.95rem;
}

/* Excel工具箱大卡片 */
.tool-card-large {
    grid-column: span 2;
}

@media (max-width: 640px) {
    .tool-card-large {
        grid-column: span 1;
    }
}

.tool-sub-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    justify-content: center;
}

.sub-btn {
    display: inline-block;
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.sub-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 紧凑头部 */
.compact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    color: white;
}

.compact-header .header-left {
    display: flex;
    align-items: baseline;
    gap: 15px;
}

.compact-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

.compact-header .header-subtitle {
    font-size: 0.9rem;
    opacity: 0.85;
}

/* 安全徽章 */
.security-badge {
    background: rgba(40, 167, 69, 0.2);
    border: 1px solid rgba(40, 167, 69, 0.4);
    color: #90EE90;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    white-space: nowrap;
}

/* 底部安全提示 */
.security-notice-bottom {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    padding: 8px 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    margin-top: 15px;
}

/* 页脚 */
footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* 工具页面通用样式 */
.tool-container {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin: 20px 0;
    flex: 1;
}

.tool-header {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.tool-header a.back {
    color: #667eea;
    text-decoration: none;
    font-size: 1.5rem;
    margin-right: 15px;
}

.tool-header h2 {
    font-size: 1.5rem;
    color: #333;
}

/* 表单元素 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
}

textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.3s;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

input[type="text"], select {
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input[type="text"]:focus, select:focus {
    outline: none;
    border-color: #667eea;
}

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-success {
    background: #28a745;
    color: white;
}

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

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 结果区域 */
.result-box {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    word-break: break-all;
    white-space: pre-wrap;
    position: relative;
}

.result-box .copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    font-size: 12px;
}

/* 选项行 */
.options-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 15px;
}

.options-row label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
    margin-bottom: 0;
}

/* 单选按钮组样式 */
.options-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 15px;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.radio-group:last-child {
    margin-bottom: 0;
}

.radio-label {
    font-weight: 600;
    color: #555;
    font-size: 13px;
    margin-right: 5px;
}

.radio-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    margin: 0;
    font-weight: normal;
}

.radio-item:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.radio-item:has(input:checked) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.radio-item input[type="radio"],
.radio-item input[type="checkbox"] {
    display: none;
}

/* 统计信息框 */
.stats-box {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 13px;
    color: #555;
    line-height: 1.8;
}

.stats-box .stat-item {
    display: inline-block;
    margin-right: 20px;
}

.stats-box .stat-label {
    color: #888;
}

.stats-box .stat-value {
    font-weight: 600;
    color: #667eea;
}

/* 多输入框区域 */
.input-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.input-item textarea {
    flex: 1;
    min-height: 80px;
}

.input-item .btn {
    flex-shrink: 0;
}

/* Tab 导航 */
.tab-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    background: #f5f5f7;
    padding: 6px;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.25s ease;
}

.tab-btn:hover {
    color: #333;
    background: rgba(255, 255, 255, 0.5);
}

.tab-btn.active {
    color: #667eea;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

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

/* 数据转换页面特殊样式 - 90% 屏幕宽高 */
.data-converter-page {
    max-width: 90vw;
    min-height: 90vh;
    margin: 5vh auto;
    padding: 20px;
}

.data-converter-page .tool-container {
    min-height: calc(90vh - 180px);
}

/* 展开面板 */
.expand-panel {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border: 2px solid #667eea;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    animation: slideDown 0.3s ease;
}

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

.expand-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #ddd;
}

.expand-panel-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.btn-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-close:hover {
    background: #eee;
    color: #333;
}

/* 强调按钮 */
.btn-accent {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(240, 147, 251, 0.4);
}

.btn-header {
    margin-left: auto;
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

/* 模式切换按钮 */
.mode-switch {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: #f0f0f0;
    border-radius: 12px;
    padding: 4px;
}

.mode-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    color: #333;
}

.mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

/* 紧凑选项布局 */
.options-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
}

.option-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border: 1px solid #e0e6ff;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.08);
}

.option-row:hover {
    border-color: #c5d0ff;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.12);
}

.option-label {
    font-weight: 600;
    font-size: 13px;
    color: #667eea;
    min-width: 50px;
}

.info-text {
    color: #666;
    font-size: 13px;
}

/* 小号结果框 */
.result-box-sm {
    min-height: 50px;
}

/* 精美药丸按钮样式 */
.pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    transition: all 0.2s ease;
    user-select: none;
}

.pill:hover {
    border-color: #667eea;
    background: #fafaff;
    color: #667eea;
}

.pill input {
    display: none;
}

.pill:has(input:checked) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.35);
}

.pill:has(input:checked):hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    color: white;
}

.pill-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* 多选 checkbox 样式 */
.pill-check:has(input:checked) {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.pill-check:has(input:checked):hover {
    background: linear-gradient(135deg, #218838 0%, #1aa179 100%);
}

.option-row-wide {
    flex: 1 1 100%;
}

/* 推荐工具区域 */
.recommend-section {
    margin-top: 40px;
    padding: 30px 0;
}

.recommend-section h2 {
    color: white;
    text-align: center;
    font-size: 1.6rem;
    margin-bottom: 25px;
}

.recommend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.recommend-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 25px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.recommend-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.recommend-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.recommend-card h3 {
    font-size: 0.9rem;
    color: #667eea;
    margin-bottom: 5px;
    font-weight: 600;
}

.recommend-card h4 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 10px;
}

.recommend-card p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 12px;
}

.recommend-link {
    display: inline-block;
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.recommend-link:hover {
    color: #764ba2;
}

.recommend-hint {
    display: block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    text-align: center;
}

/* 联系方式区域 */
.contact-section {
    text-align: center;
    padding: 30px 0;
    margin-top: 20px;
}

.contact-section h2 {
    color: white;
    font-size: 1.4rem;
    margin-bottom: 15px;
}

.contact-section p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
}

.contact-section a {
    color: #ffd700;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.contact-section a:hover {
    color: #fff;
    text-decoration: underline;
}

/* 响应式 */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .tool-container {
        padding: 20px;
    }
    
    .options-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .recommend-grid {
        grid-template-columns: 1fr;
    }
    
    .recommend-section h2 {
        font-size: 1.3rem;
    }
}
