﻿/* 共享样式文件 - 用于所有页面的统一样式 */

/* CSS变量定义 - 统一色调 */
:root {
    --primary-color: #2563eb;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --background-color: #fafbfc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --gradient-primary: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    
    /* 统一的功能色彩 */
    --success-color: #28a745;
    --success-light: #d4edda;
    --success-border: #c3e6cb;
    --warning-color: #ffc107;
    --warning-light: #fff3cd;
    --warning-border: #ffeaa7;
    --error-color: #dc3545;
    --error-light: #f8d7da;
    --error-border: #f5c6cb;
    --info-color: #2196f3;
    --info-light: #e3f2fd;
    --info-border: #b3d9ff;
    
    /* 统一的页面元素色彩 */
    --page-header-bg: #2c3e50;
    --page-header-text: #7f8c8d;
    --card-bg: #f8f9fa;
    --card-border: #e9ecef;
    --table-header-bg: #f8f9fa;
    --table-border: #ddd;
}

/* 基础重置和通用样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

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

/* 页头样式 */
header {
    background: #FFFFFF;
    margin-bottom: 16px;
    color: var(--text-primary);
    padding: 8px 0;
    box-shadow: 0 6px 16px 0 rgba(59, 104, 252, 0.1), 0px 1px 2.8px 1px rgba(41, 76, 194, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand {
    display: flex;
    align-items: center;
}

.logo {
    height: 40px;
    width: auto;
}

.logo-link {
    text-decoration: none;
    display: inline-block;
    transition: opacity 0.2s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px;
    color: var(--text-primary);
    width: 48px;
    height: 48px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.mobile-menu-toggle:hover {
    background-color: var(--border-light);
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 3px;
    background-color: var(--text-primary);
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.main-nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
}

.nav-link:hover {
    color: var(--primary-color);
    background: var(--border-light);
}

.nav-link.active {
    color: var(--primary-color);
    background: var(--surface-color);
    border-color: var(--primary-color);
}

.language-selector select {
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.language-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.language-selector select option {
    background: var(--surface-color);
    color: var(--text-primary);
}

/* 页脚样式 */
.footer {
    background: var(--text-primary);
    border-top: 1px solid var(--border-color);
    color: white;
    margin-top: 30px;
    padding: 25px 0 15px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.footer-section h3 {
    color: white;
    font-size: 1.2em;
    margin-bottom: 15px;
    font-weight: 600;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.footer-section h4 {
    color: white;
    font-size: 1.2em;
    margin-bottom: 15px;
    font-weight: 600;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-bottom: 10px;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
    padding-left: 0;
}

.footer-section ul li:before {
            content: "▸";
            color: var(--primary-light);
            margin-right: 8px;
        }

        .footer-section a {
            color: rgba(255, 255, 255, 0.8);
            text-decoration: none;
            transition: color 0.3s ease;
        }

        .footer-section a:hover {
            color: white;
            text-decoration: none;
        }

        .footer-links a {
            color: rgba(255, 255, 255, 0.8);
            text-decoration: none;
            margin-right: 15px;
            transition: color 0.3s ease;
        }

        .footer-links a:hover {
            color: white;
            text-decoration: none;
        }

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 20px;
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* 移动端响应式设计 */
@media (max-width: 768px) {
    .header-content {
        padding: 0 16px;
    }
    
    .header-right {
        gap: 12px;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        width: 200px;
        background: white;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        box-shadow: var(--shadow-md);
        flex-direction: column;
        padding: 8px;
        z-index: 1000;
    }
    
    .main-nav.active {
        display: flex;
    }
    
    .nav-link {
        padding: 12px 16px;
        font-size: 14px;
        border-bottom: 1px solid var(--border-color);
        text-align: center;
        background: var(--surface-color) !important;
        color: var(--text-secondary) !important;
        border: 2px solid var(--border-color) !important;
    }
    
    /* 通用移动端样式 */
    .container {
        padding: 10px !important;
    }
    
    .page-header h1 {
        font-size: 2em !important;
    }
    
    .page-header p {
        font-size: 1em !important;
    }
    
    /* 网格布局移动端适配 */
    .example-grid,
    .application-grid,
    .method-grid,
    .formula-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    /* 标签页移动端适配 */
    .difficulty-tabs,
    .tabs {
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
    }
    
    .tab-button {
        width: 100% !important;
        max-width: 200px !important;
        text-align: center !important;
    }
    
    /* 表格移动端适配 */
    table {
        font-size: 14px !important;
        overflow-x: auto !important;
        display: block !important;
        white-space: nowrap !important;
    }
    
    /* 卡片移动端适配 */
    .card,
    .example-card,
    .method-card,
    .application-card {
        margin-bottom: 15px !important;
        padding: 15px !important;
    }
    
    /* 页脚移动端适配 */
    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        text-align: center !important;
        width: 100%;
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
    
    .brand-text {
        display: none;
    }
    
    .container {
        padding: 0 16px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 16px;
    }
    
    .footer-section {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .brand-text {
        display: block;
    }
}

/* 通用内容样式 */
.content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.page-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.page-header h1 {
    color: var(--page-header-bg);
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.page-header p {
    color: var(--page-header-text);
    font-size: 1.2em;
}

/* 通用卡片样式 */
.card,
.example-card,
.method-card,
.application-card,
.concept-card {
    background: var(--card-bg) !important;
    border: 2px solid var(--card-border) !important;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

/* 通用表格样式 */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 20px 0;
}

table th {
    background: var(--table-header-bg) !important;
    border: 1px solid var(--table-border) !important;
    padding: 8px;
    text-align: left;
}

table td {
    border: 1px solid var(--table-border) !important;
    padding: 8px;
}

/* 通用状态样式 */
.success,
.success-message {
    background: var(--success-light) !important;
    border: 1px solid var(--success-border) !important;
    color: var(--success-color) !important;
}

.warning,
.warning-message {
    background: var(--warning-light) !important;
    border: 2px solid var(--warning-border) !important;
    color: #856404 !important;
}

.error,
.error-message {
    background: var(--error-light) !important;
    border: 1px solid var(--error-border) !important;
    color: var(--error-color) !important;
}

.info,
.info-message {
    background: var(--info-light) !important;
    border-left: 4px solid var(--info-color) !important;
    color: #1565c0 !important;
}

/* 通用按钮样式 */
.btn-primary,
.calculator-link {
    background: var(--gradient-primary) !important;
    color: var(--text-primary) !important;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: inline-block;
}

.btn-primary:hover,
.calculator-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: var(--gradient-primary) !important;
    color: var(--text-primary) !important;
}

.btn-success {
    background: var(--success-color) !important;
    color: white !important;
}

.btn-success:hover {
    background: #218838 !important;
}

/* 导航链接样式 */
.nav-links {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-links .nav-link {
    background: var(--gradient-primary);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.nav-links .nav-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: var(--gradient-primary);
    color: var(--text-primary);
}

/* 计算器链接样式 */
.calculator-link {
    display: inline-block;
    background: var(--gradient-primary);
    color: var(--text-primary);
    padding: 15px 30px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1em;
    margin: 20px 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    text-align: center;
}

.calculator-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: var(--gradient-primary);
    color: var(--text-primary);
}

/* 计算器通用样式 */
.calculator-container {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.input-section h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.8em;
    text-align: center;
}

.input-group {
    margin-bottom: 20px;
}

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

.coordinate-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.coordinate-inputs input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
    background: var(--surface-color);
    color: var(--text-primary);
}

.coordinate-inputs input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.coordinate-inputs input::placeholder {
    color: var(--text-secondary);
}

.coordinate-inputs span {
    font-weight: bold;
    color: #666;
}

.calculate-btn {
    width: 100%;
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    position: relative;
    overflow: hidden;
}

.calculate-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.calculate-btn:hover::before {
    width: 300px;
    height: 300px;
}

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

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

.result-section {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.result-section h2 {
    color: var(--text-primary);
    margin-bottom: 16px;
    font-size: 1.25em;
    font-weight: 600;
    text-align: center;
}

.result-display {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #e1e5e9;
}

.result-value {
    font-size: 2em;
    font-weight: bold;
    color: rgb(126,158,255);
    margin-bottom: 10px;
}

.result-formula {
    color: #666;
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    margin-top: 15px;
}

.steps {
    margin-top: 20px;
}

.steps h3 {
    color: #333;
    margin-bottom: 15px;
}

.step {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 3px solid rgb(126,158,255);
}

.info-section {
    background: #ffffff;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border: 1px solid rgba(126,158,255,0.2);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.info-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    border-top: 4px solid var(--primary-color);
}

.info-card h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-card p {
    color: #666;
    line-height: 1.6;
}

.info-card-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.info-card h3 span {
    font-size: 0.8em;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.formula-display {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    border: 2px solid #e1e5e9;
}

/* 输入模式标签页样式 */
.input-tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 2px solid #e1e5e9;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn:hover {
    color: var(--primary-color);
    background: rgba(102, 126, 234, 0.05);
}

.input-mode {
    display: none;
}

.input-mode.active {
    display: block;
}

.function-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    transition: border-color 0.3s ease;
}

.function-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.function-help {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
    font-style: italic;
}

@media (max-width: 768px) {
    .calculator-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .coordinate-inputs {
        flex-direction: column;
        gap: 10px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .info-card {
        padding: 20px;
    }
    
    .info-section {
        padding: 30px 20px;
    }
    
    .formula-display {
        font-size: 1em;
        padding: 15px;
    }
    
    .calculator-container {
        padding: 25px;
    }
    
    .nav-links {
        flex-direction: column;
        align-items: center;
    }
    
    .nav-links .nav-link {
        width: 100%;
        max-width: 300px;
        text-align: center;
    }
    
    .calculator-link {
        width: 100%;
        max-width: 300px;
    }
    
    .footer {
        padding: 20px 16px;
    }
    
    .footer-content {
        display: none;
    }
    
    .footer-bottom {
        text-align: center;
        border-top: none;
        margin-top: 0;
        padding-top: 0;
    }
    
    .footer-bottom p {
        font-size: 14px;
        margin: 0;
        padding: 8px 0;
        color: rgba(255,255,255,0.9);
    }
}

/* Input Mode Tabs */
.input-tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 2px solid #e1e5e9;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn:hover {
    color: var(--primary-color);
    background: rgba(102, 126, 234, 0.05);
}

/* Input Modes */
.input-mode {
    display: none;
}

.input-mode.active {
    display: block;
}

/* Function Input Styles */
.function-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    transition: border-color 0.3s ease;
}

.function-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.function-help {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
    font-style: italic;
}

/* Tutorial Section */
.tutorial-section {
    background: rgba(255,255,255,0.95);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
}

.tutorial-tabs {
    display: flex;
    margin-bottom: 16px;
    border-bottom: 2px solid #e1e5e9;
}

.tutorial-tab {
    flex: 1;
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tutorial-tab:hover {
    color: var(--primary-color);
    background: rgba(102, 126, 234, 0.05);
}

.tutorial-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
}

.tutorial-content {
    display: none;
}

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

.example-box {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    font-family: 'Courier New', monospace;
}

.example-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    font-family: 'Segoe UI', sans-serif;
}