/* 全局样式 */
:root {
    color-scheme: light;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

/* 导航栏 */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-user {
    color: #ecf0f1;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-link:hover {
    background-color: #34495e;
}

/* 主内容区 */
.main-content {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* 页面标题 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    color: #2c3e50;
    font-size: 2rem;
}

/* 消息提示 */
.flash-messages {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 2rem;
}

.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background-color: #3498db !important;
    color: white !important;
}

.btn-primary:hover {
    background-color: #2980b9 !important;
}

.btn-secondary {
    background-color: #95a5a6 !important;
    color: white !important;
}

.btn-secondary:hover {
    background-color: #7f8c8d !important;
}

.btn-success {
    background-color: #27ae60 !important;
    color: white !important;
}

.btn-success:hover {
    background-color: #229954 !important;
}

.btn-danger {
    background-color: #e74c3c !important;
    color: white !important;
}

.btn-danger:hover {
    background-color: #c0392b !important;
}

.btn-info {
    background-color: #17a2b8 !important;
    color: white !important;
}

.btn-info:hover {
    background-color: #138496 !important;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.btn-large {
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
}

/* 登录/注册页面 */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 140px);
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-card h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 2rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: #7f8c8d;
}

.auth-footer a {
    color: #3498db;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* 表单 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #7f8c8d;
    font-size: 0.85rem;
}

/* 项目列表 */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #ecf0f1;
}

.project-header h3 {
    color: #2c3e50;
    font-size: 1.3rem;
    margin: 0;
    flex: 1;
}

.project-header .header-buttons {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.project-header .copy-btn,
.project-header .delete-btn {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
}

.project-type {
    background-color: #3498db;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.project-info {
    margin-bottom: 1rem;
    flex: 1;
}

.project-info p {
    margin-bottom: 0.5rem;
    color: #555;
}

.project-date {
    color: #95a5a6 !important;
    font-size: 0.9rem;
}

.project-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.empty-state p {
    font-size: 1.2rem;
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}

/* 项目表单 */
.project-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-section {
    margin-bottom: 2.5rem;
}

.form-section h2 {
    color: #2c3e50;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
}

.form-section h3 {
    color: #34495e;
    font-size: 1.2rem;
    margin: 1.5rem 0 1rem 0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #ecf0f1;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 500px;
}

.modal-large {
    max-width: 900px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

.modal-content p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
}

#modalBody {
    margin: 1.5rem 0;
}

#modalBody p {
    padding: 0.5rem 0;
}

#modalBody strong {
    display: inline-block;
    min-width: 120px;
}

#heatingLoad,
#coolingLoad {
    color: #27ae60;
    font-weight: bold;
    font-size: 1.2rem;
}

#modalMessage {
    color: #7f8c8d;
    font-style: italic;
    margin-top: 1rem;
}

.result-summary {
    background-color: #e8f5e9;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.result-summary p {
    font-size: 1.2rem;
    margin: 0.5rem 0;
}

.calculation-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.calculation-section h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

.formula-item {
    margin: 0.8rem 0;
    padding: 0.5rem;
    background-color: white;
    border-left: 3px solid #3498db;
    padding-left: 1rem;
}

.formula-item .formula {
    font-family: 'Courier New', monospace;
    color: #e74c3c;
    margin: 0.3rem 0;
}

.formula-item .coefficient {
    color: #27ae60;
    font-weight: bold;
}

.formula-item .value {
    color: #8e44ad;
    font-weight: bold;
}

.param-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.param-table th,
.param-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.param-table th {
    background-color: #3498db;
    color: white;
}

.param-table tr:hover {
    background-color: #f5f5f5;
}

/* 页脚 */
.footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
}

.footer-logo {
    max-height: 60px;
    max-width: 200px;
    object-fit: contain;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .project-actions {
        flex-direction: column;
    }

    .project-actions .btn {
        width: 100%;
        text-align: center;
        padding: 0.8rem 1rem;
        white-space: normal;
        min-height: 3rem;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1.4;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        text-align: center;
        padding: 0.8rem 1rem;
        white-space: normal;
        min-height: 3rem;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1.4;
    }
}

/* 空调结果样式 */
.ac-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    justify-items: center;
}

.ac-result-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 500px;
}

/* 移动设备响应式调整 */
@media (max-width: 768px) {
    .ac-results-grid {
        grid-template-columns: 1fr;
        justify-items: center;
    }
    
    .ac-result-card {
        max-width: 100%;
    }
    
    /* 系数编辑区域移动端响应式 */
    .coeff-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem;
        padding: 0.5rem;
        background: #f9f9f9;
        border-radius: 4px;
        margin-bottom: 0.75rem !important;
    }
    
    .coeff-row label {
        width: 100% !important;
        font-weight: 500;
    }
    
    .coeff-row input {
        width: 100% !important;
        max-width: 100% !important;
        margin-right: 0 !important;
    }
    
    .coeff-row .coeff-save-btn {
        width: 100%;
        margin-top: 0.25rem;
    }
    
    .coeff-row .coeff-desc {
        width: 100% !important;
        flex: none !important;
    }
}

.ac-result-card h4 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.ac-result-card p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

/* 折叠功能样式 */
.collapsible-section {
    margin: 1rem 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.collapsible-btn {
    width: 100%;
    background-color: #f8f9fa;
    border: none;
    padding: 1rem;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #2c3e50;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
}

.collapsible-btn:hover {
    background-color: #e9ecef;
}

.collapsible-btn.active {
    background-color: #e3f2fd;
}

.collapsible-icon {
    margin-right: 0.5rem;
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.collapsible-btn.active .collapsible-icon {
    transform: rotate(0deg);
}

.collapsible-content {
    padding: 0;
    background-color: #fff;
    border-top: 1px solid #ddd;
}

.collapsible-content > div {
    padding: 1rem;
}

/* 系数编辑区域样式 */
.coeff-group {
    margin-bottom: 1.5rem;
}

.coeff-group h4 {
    color: #2c3e50;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
    font-size: 1rem;
}

.coeff-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    gap: 0.5rem;
}

.coeff-row label {
    width: 220px;
    font-size: 0.9rem;
    color: #333;
}

.coeff-row input {
    width: 160px;
    padding: 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.coeff-row input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.coeff-save-btn {
    padding: 0.4rem 1rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.coeff-save-btn:hover {
    background-color: #2980b9;
}

.coeff-save-btn:active {
    background-color: #21618c;
}

.coeff-desc {
    flex: 1;
    font-size: 12px;
    color: #666;
    min-width: 0;
}
/* 语言切换器 */
.language-switcher {
    position: relative;
    display: inline-block;
    margin-left: 1.5rem;
}

.language-icon {
    width: 24px;
    height: 24px;
    cursor: pointer;
    transition: transform 0.3s ease;
    filter: brightness(0) invert(1);
    display: inline-block;
    vertical-align: middle; 
}

.language-icon:hover {
    transform: scale(1.1);
}

.language-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 32px;
    background-color: white;
    min-width: 150px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1000;
    border-radius: 4px;
    overflow: hidden;
}

.language-menu.active {
    display: block;
}

.language-option {
    display: block;
    width: 100%;
    padding: 0.8rem 1rem;
    border: none;
    background-color: white;
    color: #2c3e50;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 0.9rem;
    font-weight: normal;
}

.language-option:hover {
    background-color: #ecf0f1;
}

.language-option.active {
    background-color: #3498db;
    color: white;
    font-weight: bold;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .language-switcher {
        margin-left: 1rem;
    }
    
    .language-icon {
        width: 20px;
        height: 20px;
    }
}