/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

/* 头部导航 */
.header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.nav a {
    text-decoration: none;
    color: #666;
    margin-left: 30px;
    padding: 8px 16px;
    border-radius: 5px;
    transition: all 0.3s;
}

.nav a:hover, .nav a.active {
    background: #667eea;
    color: white;
}

/* 主内容区 */
.main-content {
    background: white;
    border-radius: 10px;
    padding: 30px;
    min-height: calc(100vh - 200px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 20px;
    color: white;
    margin-top: 20px;
}

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

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

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    margin-right: 5px;
}

/* 按钮样式 */
.btn-primary {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
    width: 100%;
    margin-top: 20px;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-small {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-small:hover {
    background: #5568d3;
}

.btn-icon {
    background: transparent;
    border: 1px solid #667eea;
    color: #667eea;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

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

.btn-icon.favorited {
    color: #f39c12;
    border-color: #f39c12;
}

/* 当前时间显示 */
.current-time {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
    color: #667eea;
    font-weight: 500;
}

/* 时间输入区域 */
.time-input {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.time-input input {
    flex: 1;
    min-width: 150px;
}

/* 卦象输入表格 */
.gua-input-table table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.gua-input-table th,
.gua-input-table td {
    padding: 10px;
    border: 1px solid #e0e0e0;
    text-align: center;
}

.gua-input-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.gua-label {
    background: #f0f0f0;
    font-weight: 500;
}

.yao-select {
    width: 100%;
    padding: 5px;
}

/* 输入类型切换 */
.input-type h3 {
    margin-bottom: 15px;
    color: #667eea;
}

.hint {
    color: #999;
    font-style: italic;
}

/* 排盘结果区域 */
.result-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.result-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    text-align: center;
}

/* 排盘结果表格 */
.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.result-table th,
.result-table td {
    padding: 12px;
    border: 1px solid #e0e0e0;
    text-align: center;
}

.result-table th {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.result-table tr:nth-child(even) {
    background: #f8f9fa;
}

.result-info {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

.result-info p {
    margin: 8px 0;
    line-height: 1.6;
}

/* 历史记录页面 */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

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

.tab-btn:hover,
.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-box input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
}

.folder-management {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.records-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.record-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s;
    cursor: pointer;
}

.record-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.record-name {
    font-weight: 600;
    color: #333;
}

.record-date {
    color: #999;
    font-size: 14px;
}

.record-question {
    color: #666;
    margin-bottom: 10px;
}

.record-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.empty-state {
    text-align: center;
    padding: 50px;
    color: #999;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 10px;
    padding: 30px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
}

.modal-small {
    max-width: 400px;
}

.close-modal,
.close-folder-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}

.close-modal:hover,
.close-folder-modal:hover {
    color: #333;
}

#folder_name_input {
    width: 100%;
    padding: 10px;
    margin: 20px 0;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .logo {
        font-size: 20px;
    }

    .nav {
        display: flex;
        gap: 10px;
    }

    .nav a {
        margin-left: 0;
    }

    .main-content {
        padding: 20px;
    }

    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    .time-input {
        flex-direction: column;
    }

    .time-input input {
        width: 100%;
    }

    .result-table {
        font-size: 12px;
    }

    .result-table th,
    .result-table td {
        padding: 8px 4px;
    }

    .tabs {
        overflow-x: auto;
    }

    .tab-btn {
        white-space: nowrap;
    }
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 20px;
    color: #667eea;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 提示信息 */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
