* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: bold;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.nav-tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 2px solid #e0e0e0;
}

.nav-tab {
    flex: 1;
    padding: 18px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.nav-tab:hover {
    background: #eee;
    color: #667eea;
}

.nav-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

.tab-content {
    display: none;
    padding: 30px;
}

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

.search-form {
    background: #f9f9f9;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
}

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

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

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

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

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

.results-container {
    animation: fadeIn 0.5s ease;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.results-header h2 {
    color: #333;
}

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

.date-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s;
    cursor: pointer;
}

.date-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.date-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.solar-date {
    font-size: 1.4em;
    font-weight: bold;
    color: #667eea;
}

.lunar-date {
    color: #666;
    font-size: 0.95em;
}

.ganzhi-info {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #888;
}

.yi-ji-section {
    margin-bottom: 15px;
}

.yi-section, .ji-section {
    margin-bottom: 10px;
}

.yi-label {
    color: #4caf50;
    font-weight: bold;
    display: inline-block;
    width: 30px;
}

.ji-label {
    color: #f44336;
    font-weight: bold;
    display: inline-block;
    width: 30px;
}

.yi-items, .ji-items {
    display: inline-block;
    color: #555;
}

.extra-info {
    font-size: 0.85em;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.info-item {
    background: #f5f5f5;
    padding: 3px 8px;
    border-radius: 4px;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
}

.pagination button:hover {
    background: #f0f0f0;
}

.pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.favorite-card {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    position: relative;
}

.favorite-card .delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f44336;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background: #f9f9f9;
    padding: 15px 20px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-info {
    display: flex;
    gap: 15px;
}

.history-date {
    color: #667eea;
    font-weight: bold;
}

.history-category {
    color: #666;
}

.history-time {
    color: #999;
    font-size: 0.9em;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: slideDown 0.3s;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.modal-body h2 {
    color: #667eea;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.modal-detail-row {
    display: flex;
    margin-bottom: 12px;
}

.modal-detail-label {
    font-weight: bold;
    width: 120px;
    color: #333;
}

.modal-detail-value {
    color: #666;
    flex: 1;
}

.modal-yi-ji {
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
}

.modal-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.error {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }

    .nav-tab {
        padding: 15px 10px;
        font-size: 0.9em;
    }
}
