/* Base Styles and Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "SimSun", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><rect width="100" height="100" fill="none" stroke="%23e8e8e8" stroke-width="1"/></svg>');
    background-size: 50px 50px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1,
h2,
h3,
h4 {
    font-weight: normal;
    margin-bottom: 15px;
    color: #8b0000;
}

h1 {
    font-size: 2.2em;
    text-align: center;
    letter-spacing: 2px;
}

h2 {
    font-size: 1.8em;
    border-bottom: 2px solid #8b0000;
    padding-bottom: 10px;
    margin-top: 30px;
}

h3 {
    font-size: 1.4em;
    border-left: 4px solid #8b0000;
    padding-left: 10px;
    margin-top: 20px;
}

p {
    margin-bottom: 15px;
}

ul,
ol {
    margin-left: 25px;
    margin-bottom: 15px;
}

a {
    color: #8b0000;
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: #c00000;
    text-decoration: underline;
}

/* Header Styles */
.site-header {
    margin-bottom: 30px;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><path d="M30,10 L70,10 L70,90 L30,90 Z" fill="none" stroke="%23f9f3e9" stroke-width="1"/></svg>');
    border: 1px solid #e0e0e0;
}

.daily-update {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    background-color: #f9f3e9;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #e8e8e8;
}

.daily-luck {
    color: #8b0000;
    font-style: italic;
}

/* Main Content Styles */
main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

section {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

/* Calculator Section */
.calculator-section {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
}

input,
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    color: #333;
}

input:focus,
select:focus {
    border-color: #8b0000;
    outline: none;
    box-shadow: 0 0 5px rgba(139, 0, 0, 0.2);
}

.form-buttons {
    display: flex;
    gap: 15px;
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.primary-button {
    background-color: #8b0000;
    color: white;
}

.primary-button:hover {
    background-color: #a00000;
}

.secondary-button {
    background-color: #f0f0f0;
    color: #333;
}

.secondary-button:hover {
    background-color: #e0e0e0;
}

/* Results Container */
#result-container {
    margin-top: 30px;
    padding: 20px;
    background-color: #f9f3e9;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
}

#loading {
    text-align: center;
    color: #8b0000;
    font-style: italic;
}

.result-hidden {
    display: none;
}

/* Knowledge Section */
.knowledge-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

article {
    padding: 20px;
    background-color: #f9f3e9;
    border-radius: 5px;
    border: 1px solid #e8e8e8;
}

/* Daily Update Section */
.daily-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.daily-item {
    padding: 15px;
    background-color: #f9f3e9;
    border-radius: 5px;
    border: 1px solid #e8e8e8;
}

/* Footer */
footer {
    margin-top: 40px;
    text-align: center;
    padding: 20px;
    background-color: #f9f3e9;
    border-radius: 8px;
    color: #666;
    font-size: 14px;
    border: 1px solid #e8e8e8;
}

/* ICP Registration styling */
footer .beian {
    margin-top: 10px;
    font-size: 13px;
}

footer .beian a {
    color: #8b0000;
    text-decoration: none;
    opacity: 0.8;
}

footer .beian a:hover {
    text-decoration: underline;
    opacity: 1;
}

/* Friend Links styling */
.friend-links {
    margin-top: 20px;
    text-align: left;
    border-top: 1px dashed #e0e0e0;
    padding-top: 20px;
}

.friend-links h4 {
    text-align: center;
    font-size: 18px;
    color: #8b0000;
    margin-bottom: 15px;
}

.link-groups {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.link-group {
    background-color: #fff;
    border-radius: 5px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.link-group h5 {
    color: #8b0000;
    font-size: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 10px;
}

.link-group ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}

.link-group li {
    margin: 5px 10px 5px 0;
}

.link-group a {
    color: #666;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
    white-space: nowrap;
}

.link-group a:hover {
    color: #8b0000;
    text-decoration: underline;
}

/* Media queries for friend links */
@media (min-width: 768px) {
    .link-groups {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .link-groups {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* BaZi Chart Styles */
.bazi-chart {
    margin: 30px 0;
    overflow-x: auto;
}

.bazi-chart table {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #8b0000;
    background-color: #fff;
}

.bazi-chart th,
.bazi-chart td {
    padding: 12px;
    text-align: center;
    border: 1px solid #ddd;
}

.bazi-chart th {
    background-color: #8b0000;
    color: white;
}

.bazi-chart tr:nth-child(even) {
    background-color: #f9f3e9;
}

.chart-cell-header {
    font-weight: bold;
    color: #8b0000;
}

.chart-cell-content {
    font-size: 1.2em;
}

.chart-cell-note {
    font-size: 0.9em;
    color: #666;
}

/* WuXing Analysis */
.wuxing-analysis {
    margin: 30px 0;
}

.wuxing-bar {
    height: 25px;
    margin: 10px 0;
    background-color: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.wuxing-bar-fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.wuxing-jin {
    background-color: #e6b422;
}

.wuxing-mu {
    background-color: #3cb371;
}

.wuxing-shui {
    background-color: #1e90ff;
}

.wuxing-huo {
    background-color: #ff4500;
}

.wuxing-tu {
    background-color: #8b4513;
}

/* Encyclopedia Section */
.encyclopedia-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

.encyclopedia-item {
    padding: 20px;
    background-color: #f9f3e9;
    border-radius: 5px;
    border: 1px solid #e8e8e8;
}

/* Tools Section */
.tools-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.tool-item {
    padding: 20px;
    background-color: #f9f3e9;
    border-radius: 5px;
    border: 1px solid #e8e8e8;
}

.tool-description {
    margin-bottom: 15px;
}

.tool-interface {
    padding: 15px;
    background-color: #fff;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

.tool-select {
    width: 200px;
    margin-right: 10px;
}

.tool-button {
    padding: 8px 15px;
    background-color: #8b0000;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.tool-button:hover {
    background-color: #a00000;
}

.tool-result {
    margin-top: 15px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.tool-form {
    margin-bottom: 15px;
}

.form-row {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.lucky-hour-tag {
    display: inline-block;
    padding: 5px 10px;
    margin: 5px;
    background-color: #8b0000;
    color: white;
    border-radius: 3px;
}

.jiazi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.jiazi-table th,
.jiazi-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

.jiazi-table th {
    background-color: #8b0000;
    color: white;
}

/* Masters Section */
.masters-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

.master-quote {
    padding: 20px;
    background-color: #f9f3e9;
    border-radius: 5px;
    border: 1px solid #e8e8e8;
}

.master-info {
    margin-bottom: 15px;
}

.master-title {
    color: #666;
    font-style: italic;
}

blockquote.master-words {
    padding: 15px;
    background-color: #fff;
    border-left: 4px solid #8b0000;
    margin: 15px 0;
    font-style: italic;
}

.quote-explanation {
    color: #666;
    margin-top: 10px;
}

/* FAQ Section */
.faq-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.faq-item {
    padding: 20px;
    background-color: #f9f3e9;
    border-radius: 5px;
    border: 1px solid #e8e8e8;
}

.faq-question {
    cursor: pointer;
    position: relative;
    padding-right: 30px;
}

.faq-question:after {
    content: '+';
    position: absolute;
    right: 10px;
    top: 0;
}

.faq-question.active:after {
    content: '-';
}

.faq-answer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

/* Media Queries for Responsive Design */
@media (min-width: 768px) {
    .knowledge-content {
        grid-template-columns: repeat(2, 1fr);
    }

    .daily-content {
        grid-template-columns: repeat(2, 1fr);
    }

    .encyclopedia-content {
        grid-template-columns: repeat(2, 1fr);
    }

    .tools-content {
        grid-template-columns: repeat(2, 1fr);
    }

    .masters-content {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-group {
        display: flex;
        align-items: center;
    }

    .form-row {
        flex-direction: row;
        align-items: center;
    }

    .form-row label {
        width: 120px;
        flex-shrink: 0;
    }

    label {
        flex: 0 0 150px;
        margin-bottom: 0;
    }
}

@media (min-width: 992px) {
    main {
        grid-template-columns: 7fr 5fr;
    }

    .calculator-section {
        grid-column: 1 / 3;
    }

    .knowledge-section {
        grid-column: 1 / 3;
    }

    .daily-update-section {
        grid-column: 1 / 3;
    }

    .encyclopedia-section {
        grid-column: 1 / 3;
    }

    .tools-section {
        grid-column: 1 / 3;
    }

    .masters-section {
        grid-column: 1 / 3;
    }

    .faq-section {
        grid-column: 1 / 3;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fadeIn {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes highlight {
    0% {
        background-color: #f9f3e9;
    }

    50% {
        background-color: #ffe7e7;
    }

    100% {
        background-color: #f9f3e9;
    }
}

.highlight {
    animation: highlight 2s ease-in-out;
}