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

/* Calendar Grid Styles */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 2rem;
}

.month-calendar {
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.month-title {
    background-color: #f4f4f4;
    padding: 0.5rem;
    text-align: center;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background-color: #f9f9f9;
    font-size: 0.8rem;
    padding: 0.5rem 0;
}

.weekday {
    text-align: center;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #ddd;
}

.day {
    background-color: white;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.9rem;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day:empty {
    background-color: white;
}

.day.payday {
    background-color: #e8f5e8;
}

.day.holiday {
    background-color: #ffebee;
    font-weight: bold;
}

.day.floating-holiday {
    background-color: #e3f2fd;
    position: relative;
}

.day.floating-holiday::after {
    content: '△';
    position: absolute;
    top: 0;
    right: 0;
    font-size: 0.7rem;
    color: #1976d2;
}

.holidays-legend-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 2rem;
}

.holidays-list {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 1rem;
}

.holidays-list h2 {
    margin-bottom: 1rem;
    color: #333;
}

.holidays-list ul {
    list-style: none;
}

.holidays-list li {
    margin-bottom: 0.5rem;
}

.legend {
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.legend-symbol {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
}

.legend-symbol.payday {
    background-color: #e8f5e8;
}

.legend-symbol.holiday {
    background-color: #ffebee;
}

.legend-symbol.floating-holiday {
    background-color: #e3f2fd;
}

.calendar-header {
    background-color: #009688;
    color: white;
    padding: 1rem;
    text-align: center;
    margin-bottom: 2rem;
}

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

a {
  text-decoration: none; /* 核心取消下划线 */
  color: #ffffff; /* 可自定义链接颜色，避免默认蓝色 */
}
/* 可选：鼠标悬浮时是否显示下划线，按需加 */
a:hover {
  text-decoration: underline; /* 悬浮显示，不想要就删这行 */
  color: #ffffff; /* 悬浮变色 */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

/* Header Styles */
header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    padding: 20px 0;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
}

.menu {
    list-style: none;
    display: flex;
    gap: 30px;
}

.menu li a {
    text-decoration: none;
    color: #34495e;
    font-weight: 500;
    transition: color 0.3s ease;
}

.menu li a:hover {
    color: #3498db;
}

/* Section Styles */
.section {
    padding: 60px 0;
}

.section:nth-child(even) {
    background-color: #fff;
}

h2 {
    font-size: 32px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 40px;
    text-align: center;
}

/* Form Styles */
.options-form {
    background-color: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 40px;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    background-color: #fff;
}

.form-actions {
    margin-top: 30px;
    text-align: center;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

#generate-btn {
    background-color: #3498db;
    color: #fff;
}

#generate-btn:hover {
    background-color: #2980b9;
}

/* Calendar Result Styles */
.calendar-result {
    background-color: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 40px;
}

.calendar {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 40px;
    border: 1px solid #ddd;
}

.calendar th {
    padding: 8px 12px;
    text-align: center;
    border: 1px solid #ddd;
    height: auto;
    min-height: 30px;
    vertical-align: middle;
    background-color: #f8f9fa;
    font-weight: 600;
}

.calendar td {
    padding: 12px;
    text-align: right;
    border: 1px solid #ddd;
    height: 80px;
    min-height: 80px;
    vertical-align: top;
    position: relative;
}

.calendar td {
    min-height: 80px;
}

.calendar td small {
    font-size: 9px;
    line-height: 1.1;
    display: block;
    margin-top: 4px;
    word-break: break-word;
    text-align: left;
    max-height: 30px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-footer {
    text-align: right;
    font-size: 10px;
    color: #999;
    margin-top: 10px;
    page-break-inside: avoid;
    page-break-after: avoid;
}

.calendar th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.calendar .holiday {
    background-color: #fff3cd;
    color: #856404;
}

.calendar .weekend {
    background-color: #f8f9fa;
}

/* Export Options Styles */
.export-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.export-options button {
    background-color: #6c757d;
    color: #fff;
}

.export-options button:hover {
    background-color: #5a6268;
}

/* Footer Styles */
footer {
    background-color: #2c3e50;
    color: #fff;
    padding: 40px 0;
    text-align: center;
}

/* Responsive Styles */
@media (max-width: 768px) {
    nav .container {
        flex-direction: column;
        gap: 20px;
    }

    .menu {
        gap: 20px;
    }

    .options-form {
        padding: 20px;
    }

    .export-options {
        flex-direction: column;
        align-items: center;
    }

    .export-options button {
        width: 100%;
        max-width: 200px;
    }
}

/* Print Styles */
@media print {
    /* Hide unnecessary elements but keep calendar content */
    header,
    footer,
    .options-form,
    .export-options,
    #calendar-planner {
        display: none !important;
    }

    /* Set html and body to full height */
    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-family: Arial, sans-serif !important;
        font-size: 9pt !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* Reset container styles */
    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px !important;
        margin: 0 !important;
        height: 100% !important;
    }

    /* Calendar container styles */
    .calendar-container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Calendar header styles */
    .calendar-header {
        background-color: #009688 !important;
        color: white !important;
        padding: 0.5rem !important;
        text-align: center !important;
        margin-bottom: 1rem !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .calendar-header h1 {
        font-size: 14pt !important;
        margin: 0 !important;
    }

    /* Hide print button in print view */
    #print-btn {
        display: none !important;
    }

    /* Holidays and Legend container for print */
    .holidays-legend-container {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        margin-top: 1rem !important;
        page-break-inside: avoid !important;
    }

    /* Calendar grid styles for print */
    .calendar-grid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 1rem !important;
        page-break-inside: avoid !important;
    }

    /* Month calendar styles */
    .month-calendar {
        border: 1px solid #ddd !important;
        border-radius: 3px !important;
        overflow: hidden !important;
        page-break-inside: avoid !important;
    }

    .month-title {
        background-color: #f4f4f4 !important;
        padding: 0.3rem !important;
        text-align: center !important;
        font-weight: bold !important;
        border-bottom: 1px solid #ddd !important;
        font-size: 10pt !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .calendar-weekdays {
        display: grid !important;
        grid-template-columns: repeat(7, 1fr) !important;
        background-color: #f9f9f9 !important;
        font-size: 7pt !important;
        padding: 0.2rem 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .weekday {
        text-align: center !important;
    }

    .calendar-days {
        display: grid !important;
        grid-template-columns: repeat(7, 1fr) !important;
        gap: 1px !important;
        background-color: #ddd !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .day {
        background-color: white !important;
        padding: 0.3rem !important;
        text-align: center !important;
        font-size: 8pt !important;
        min-height: 30px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        border: 1px solid #ddd !important;
    }

    .day:empty {
        background-color: white !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Style for payday */
    .day.payday {
        background-color: #e8f5e8 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Style for holiday */
    .day.holiday {
        background-color: #ffebee !important;
        font-weight: bold !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Style for floating holiday */
    .day.floating-holiday {
        background-color: #e3f2fd !important;
        position: relative !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .day.floating-holiday::after {
        content: '△' !important;
        position: absolute !important;
        top: 0 !important;
        right: 0 !important;
        font-size: 6pt !important;
        color: #1976d2 !important;
    }

    /* Holidays list styles */
    .holidays-list {
        border: 1px solid #ddd !important;
        border-radius: 3px !important;
        padding: 0.8rem !important;
        margin-top: 1rem !important;
        page-break-inside: avoid !important;
    }

    .holidays-list h2 {
        margin-bottom: 0.5rem !important;
        color: #333 !important;
        font-size: 12pt !important;
    }

    .holidays-list ul {
        list-style: none !important;
    }

    .holidays-list li {
        margin-bottom: 0.3rem !important;
        font-size: 8pt !important;
    }

    /* Legend styles */
    .legend {
        margin-top: 1rem !important;
        padding: 0.8rem !important;
        border: 1px solid #ddd !important;
        border-radius: 3px !important;
        background-color: #f9f9f9 !important;
        page-break-inside: avoid !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .legend h3 {
        margin-bottom: 0.5rem !important;
        font-size: 10pt !important;
    }

    .legend-item {
        display: flex !important;
        align-items: center !important;
        margin-bottom: 0.3rem !important;
        font-size: 8pt !important;
    }

    .legend-symbol {
        width: 15px !important;
        height: 15px !important;
        margin-right: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border: 1px solid #ddd !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .legend-symbol.payday {
        background-color: #e8f5e8 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .legend-symbol.holiday {
        background-color: #ffebee !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .legend-symbol.floating-holiday {
        background-color: #e3f2fd !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* Loading Animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Message */
.error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
}

/* Success Message */
.success {
    background-color: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
}

/* Holidays List Styles */
#holidays-list {
    background-color: #fff;
}

.holidays-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.holiday-country {
    background-color: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.holiday-country h3 {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.holiday-country ul {
    list-style: none;
}

.holiday-country li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    color: #555;
}

.holiday-country li:last-child {
    border-bottom: none;
}

.holiday-country li:before {
    content: "•";
    color: #3498db;
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

/* Responsive for Holidays List */
@media (max-width: 768px) {
    .holidays-container {
        grid-template-columns: 1fr;
    }
    
    .holiday-country {
        padding: 20px;
    }
}