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

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 all unnecessary elements */
    header,
    .options-form,
    .export-options,
    footer,
    #calendar-planner,
    #holidays-list,
    h2,
    .calendar + div {
        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: 10pt !important;
        width: 100% !important;
        height: 100% !important;
    }

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

    /* Reset calendar result container */
    .calendar-result {
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* Make calendar fill the entire page */
    .calendar {
        page-break-after: always !important;
        page-break-inside: avoid !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 100% !important;
        border-collapse: collapse !important;
        table-layout: fixed !important;
        border: 1px solid #000 !important;
    }

    /* Force all borders to show with no color fills */
    .calendar, .calendar th, .calendar td {
        border: 1px solid #000 !important;
        background-color: transparent !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Style for month title */
    .calendar h3 {
        text-align: center !important;
        margin: 8px 0 !important;
        font-size: 16pt !important;
        page-break-after: avoid !important;
        font-weight: bold !important;
    }

    /* Style for table headers - no background color */
    .calendar th {
        padding: 6px !important;
        text-align: center !important;
        height: 30px !important;
        min-height: 30px !important;
        background-color: transparent !important;
        font-weight: bold !important;
        font-size: 10pt !important;
        border: 1px solid #000 !important;
        line-height: 1.2 !important;
    }

    /* Style for table cells - no background color */
    .calendar td {
        padding: 6px !important;
        text-align: right !important;
        height: calc((100vh - 80px) / 6) !important;
        min-height: calc((100vh - 80px) / 6) !important;
        max-height: calc((100vh - 80px) / 6) !important;
        font-size: 10pt !important;
        vertical-align: top !important;
        border: 1px solid #000 !important;
        background-color: transparent !important;
        line-height: 1.2 !important;
        overflow: hidden !important;
        white-space: normal !important;
        word-wrap: break-word !important;
    }

    /* Ensure every cell has a border */
    .calendar td:empty {
        border: 1px solid #000 !important;
        background-color: transparent !important;
        height: calc((100vh - 80px) / 6) !important;
        min-height: calc((100vh - 80px) / 6) !important;
        max-height: calc((100vh - 80px) / 6) !important;
    }

    /* Remove color fills from weekend and holiday cells */
    .calendar td.weekend,
    .calendar td.holiday,
    .calendar td.weekend.holiday {
        border: 1px solid #000 !important;
        background-color: transparent !important;
        padding: 6px !important;
        text-align: right !important;
        height: calc((100vh - 80px) / 6) !important;
        min-height: calc((100vh - 80px) / 6) !important;
        max-height: calc((100vh - 80px) / 6) !important;
        font-size: 10pt !important;
        vertical-align: top !important;
    }

    /* Style for holiday text */
    .calendar td small {
        font-size: 8pt !important;
        line-height: 1.1 !important;
        display: block !important;
        margin-top: 3px !important;
        text-align: left !important;
        word-break: break-word !important;
        max-height: 30px !important;
        overflow: hidden !important;
    }

    /* Hide the calendar footer */
    .calendar-footer {
        display: none !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;
    }
}