/* 基础样式重置 */
* {
  margin: 0;
  padding: 0;
}

body {
  background-color: #f1f2f3;
}

.container {
  box-sizing: border-box;
  max-width: 1540px;
  min-width: 1240px;
  width: 100%;
  margin: 25px auto;
  color: #333;
}

.container *{
  box-sizing: border-box;
}

header {
  text-align: center;
  position: relative;
  margin-bottom: 30px;
}

header h1 {
  font-size: 2.4rem;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

header p{
  font-size: 1rem;
  opacity: 0.9;
  max-width: 90%;
  margin: 0 auto;
  line-height: 1.6;
}

/* 计算器样式 */
.calculator {
    margin-bottom: 40px;
}

.input-area {
    margin-bottom: 20px;
	width: 100%;
}

.tool-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.btn:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-secondary {
    background: white;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.editor-container {
    margin-bottom: 20px;
}

/* CodeMirror样式定制 */
.CodeMirror {
    height: 360px !important;
    font-size: 1rem;
    font-family: 'Courier New', Courier, monospace;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

.CodeMirror-focused {
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.CodeMirror-lines{
	padding: 0 !important;
}
.CodeMirror-gutters {
    border-right: 1px solid #e2e8f0;
    background-color: #f8f9fa;
}

.CodeMirror-linenumber {
    color: #718096;
    padding: 0 10px;
}
.CodeMirror-code > div {
    border-bottom: 1px solid #eee;
	line-height: 1.5;
	font-size: 16px;
}

/* 隐藏原始textarea */
#expressionInput {
    display: none;
}

.result-area h3 {
    margin-bottom: 12px;
    color: #2d3748;
    font-size: 1.3rem;
}

.result-output {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem;
    min-height: 60px;
    white-space: pre-wrap;
    word-break: break-all;
}

.result-output .placeholder {
    color: #a0aec0;
    font-style: italic;
}
/* 结果行样式 */
.result-line {
    color: #37a169;
    padding: 4px 0;
    margin-bottom: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* 错误行样式 */
.error-message{
    background: #fed7d7;
    padding: 10px 15px;
    border-radius: 6px;
    border-left: 4px solid #e53e3e;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

/* 错误文本样式 */
.error,.error-text{
    color: #e53e3e;
    font-weight: 600;
}

/* 历史记录面板 - 改为居中弹窗 */
.history-panel {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 1000px;
    max-width: 90vw;
    height: 70vh;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
}

.history-panel.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

/* 清空历史记录按钮 */
#clearHistoryBtn {
    padding: 8px 16px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

#clearHistoryBtn:hover {
    background: #c53030;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(229, 62, 62, 0.3);
}

.history-header h3 {
    margin: 0;
    color: #2d3748;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #718096;
    padding: 5px;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: #e2e8f0;
    color: #2d3748;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    border-radius: 0 0 12px 12px;
}

.history-item {
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-time {
    font-size: 0.8rem;
    color: #a0aec0;
    margin-top: 5px;
}

.history-item:hover {
    background-color: #f8f9fa;
    padding-left: 20px;
    border-left: 4px solid #667eea;
}

.history-item:hover {
    background-color: #f8f9fa;
}

.history-item:last-child {
    border-bottom: none;
}

.history-expression {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 5px;
    word-break: break-all;
    white-space: pre-wrap;
    max-width: 100%;
    overflow-wrap: break-word;
}

.history-result {
    font-family: 'Courier New', Courier, monospace;
    color: #667eea;
    font-size: 0.95rem;
    word-break: break-all;
    white-space: pre-wrap;
    max-width: 100%;
    overflow-wrap: break-word;
}

.empty-history {
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    padding: 40px 0;
}

/* 快速函数区域 */
.quick-functions {
	
}
.quick-functions h3 {
    margin-bottom: 12px;
    color: #2d3748;
    font-size: 1.3rem;
}

.function-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.function-grid::-webkit-scrollbar {
    width: 6px;
}

.function-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.function-grid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.function-grid::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.function-btn {
    padding: 10px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.function-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* 功能特点区域 */
.features {
    margin-bottom: 60px;
}

.features h2 {
    text-align: center;
    margin-bottom: 40px;
    color: #2d3748;
    font-size: 2rem;
    position: relative;
}

.features h2::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: #667eea;
    margin: 15px auto 0;
    border-radius: 2px;
}

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

.feature-card {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.feature-card .icon {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #667eea;
}

.feature-card h3 {
    margin-bottom: 15px;
    color: #2d3748;
    font-size: 1.3rem;
}

.feature-card p {
    color: #718096;
    line-height: 1.7;
}

/* 使用示例区域 */
.examples {
    margin-bottom: 40px;
}

.examples h2 {
    text-align: center;
    margin-bottom: 40px;
    color: #2d3748;
    font-size: 2rem;
    position: relative;
}

.examples h2::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: #667eea;
    margin: 15px auto 0;
    border-radius: 2px;
}

.example-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.example-item {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: 'Courier New', Courier, monospace;
    transition: all 0.2s ease;
}

.example-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.example-item code {
    background: #f7fafc;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    color: #d69e2e;
    flex: 1;
}

.arrow {
    color: #718096;
    font-size: 1.2rem;
    font-weight: bold;
}

.example-result {
    color: #38a169;
    font-weight: bold;
    background: #f0fff4;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #c6f6d5;
}

/* 页脚样式 */
.footer {
    background: #2d3748;
    color: white;
    border-radius: 12px;
    padding: 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.footer h3 {
    margin-bottom: 20px;
    font-size: 1.3rem;
    color: #667eea;
}

.footer p {
    color: #a0aec0;
    line-height: 1.7;
	font-size: 14px;
}

.footer .notice {
    background: rgba(237, 137, 54, 0.1);
    border: 1px solid #ed8936;
    border-radius: 8px;
    padding: 20px;
}

.footer .notice p {
    color: #fed7d7;
    margin: 0;
}

.copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #4a5568;
    color: #a0aec0;
    font-size: 0.9rem;
}

/* 提示弹窗样式 */
.notice-popup {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    transition: bottom 0.3s ease;
}

.notice-popup.show {
    bottom: 30px;
}

.notice-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 响应式设计 - 虽然要求最小宽度1300px，但仍做一些适配 */
@media (max-width: 1400px) {
    .container {
        padding: 15px;
    }
    
    .main {
        padding: 30px;
    }
}

@media (max-width: 1300px) {
    body {
        min-width: auto;
    }
    
    .container {
        max-width: 100%;
    }
}