@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f0f2f5;
    color: #333; /* Màu mặc định cho toàn bộ trang */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}
.container {
    width: 100%;
    max-width: 960px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

/* =================================
   HEADER
==================================== */
.site-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.header-logo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.header-logo:hover {
    transform: scale(1.1);
}

/* SỬA LỖI: Bổ sung quy tắc còn thiếu cho tiêu đề */
.site-title {
    font-size: 1.8em;
    margin: 0;
    font-weight: 700;
}

/* =================================
   FORM & HIỂN THỊ LỊCH
==================================== */
.form-container { background-color: #fdf8e2; padding: 20px; border-radius: 8px; margin-bottom: 20px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 15px; }
.form-container label { font-weight: 500; font-size: 1.1em; color: #5c4033; }
.form-container select { font-size: 1em; padding: 10px 15px; border-radius: 5px; border: 1px solid #d4c0a1; width: 350px; max-width: 100%; }

.time-display-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 25px; text-align: center; }
.clock-card { background-color: #f8f9fa; padding: 15px 20px; border-radius: 8px; border: 1px solid #dee2e6; }
.clock-card h3 { margin: 0 0 10px 0; font-size: 1.1em; color: #3c4043; font-weight: 500; }
.clock-card .time { font-size: 2.2em; font-weight: 500; color: #1a73e8; letter-spacing: 2px; }
.date-gregorian { font-size: 1.2rem; color: #5f6368; margin-bottom: 30px; font-weight: 500; text-align: center; }

.calendar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 25px; text-align: left; }
.card { background-color: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; padding: 25px; display: flex; flex-direction: column; }
.card h2 { font-size: 1.5rem; color: #3c4043; margin-top: 0; margin-bottom: 20px; border-bottom: 2px solid #8f5b21; padding-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.card p { font-size: 1.1rem; line-height: 1.7; margin: 8px 0; }
.card p strong { color: #202124; min-width: 120px; display: inline-block; }
.leap-month { color: #d93025; font-weight: bold; }
.major-event { color: #d93025; }

.buddhist-era-display { text-align: center; }
.buddhist-era-year { font-size: 3.5rem; margin: 15px 0 5px 0; color: #8f5b21; font-weight: 500; line-height: 1.1; }
.buddhist-era-desc { font-size: 0.9em; color: #666; margin-top: 0; }

/* =================================
   CÔNG CỤ CHUYỂN ĐỔI
==================================== */
.converter-section { margin-top: 40px; padding: 25px; background-color: #f8f9fa; border-radius: 8px; border: 1px solid #dee2e6; }
.converter-section h2 { text-align: center; margin-top: 0; color: #8f5b21; }
.converter-wrapper { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.converter-box { padding: 20px; border: 1px solid #e0e0e0; border-radius: 8px; background-color: #fff; }
.converter-box h3 { text-align: center; margin-top: 0; font-size: 1.3em; }
.converter-form { display: flex; flex-direction: column; gap: 15px; }
.converter-form input[type="date"], .converter-form input[type="number"] { font-family: 'Roboto', sans-serif; font-size: 1em; padding: 8px 10px; border-radius: 5px; border: 1px solid #ccc; width: 100%; box-sizing: border-box; }
.lunar-inputs { display: grid; grid-template-columns: 1fr 1fr 1.5fr auto; gap: 10px; align-items: center; }
.leap-label { display: flex; align-items: center; white-space: nowrap; font-size: 0.9em; }
.converter-result { margin-top: 20px; }
.error-message { color: #d93025; font-weight: bold; text-align: center; padding: 20px; }

/* =================================
   FOOTER
==================================== */
footer { margin-top: 40px; padding-top: 20px; border-top: 1px solid #e0e0e0; }
.footer-content { display: flex; align-items: center; justify-content: center; gap: 15px; flex-wrap: wrap; text-align: center; }
.footer-logo img { width: 50px; height: 50px; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.footer-text .copyright { margin: 0; }
.footer-text .copyright a { font-size: 1.1em; color: #8f5b21; text-decoration: none; font-weight: 500; }
.footer-text .copyright a:hover { text-decoration: underline; }
.footer-text .location-info { margin-top: 5px; font-size: 0.9em; color: #888; }

/* =================================
   MEDIA QUERIES
==================================== */
@media (max-width: 768px) {
    .converter-wrapper {
        grid-template-columns: 1fr;
    }
}

/* TỐI ƯU: Gộp hai khối @media bị trùng lặp */
@media (max-width: 576px) {
    .form-container {
        flex-direction: column;
        align-items: stretch;
    }
    .form-container select {
        width: 100%;
    }
    .form-container label {
        text-align: left;
        margin-bottom: 5px;
    }
    .lunar-inputs {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    .lunar-inputs input[name="lunar_year_to_convert"] {
        grid-column: 1 / span 2;
    }
}