.task-item {
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.task-item:hover {
    background-color: #f8f9fa;
}

.task-item.completed {
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.task-item.completed .task-name {
    text-decoration: line-through;
    color: #6c757d;
}

.task-name {
    font-size: 0.9rem;
}

.task-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.highfreq-item {
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.highfreq-card {
    padding: 14px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: white;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.highfreq-card:hover {
    border-color: #0d6efd;
    box-shadow: 0 3px 10px rgba(13, 110, 253, 0.15);
    transform: translateY(-2px);
}

.highfreq-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.highfreq-card-title {
    font-weight: bold;
    font-size: 0.95rem;
    color: #333;
    flex: 1;
    word-break: break-word;
}

.highfreq-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.highfreq-card-desc {
    font-size: 0.8rem;
    color: #6c757d;
    flex: 1;
}

#calendar-container {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    padding: 6px;
}

.calendar-header {
    font-weight: bold;
    text-align: center;
    padding: 8px 4px;
    background-color: #f8f9fa;
    border-radius: 6px;
    font-size: 0.85rem;
}

.calendar-day {
    min-height: 135px;
    height: 135px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    overflow: hidden;
}

.calendar-day:hover {
    background-color: #f0f8ff;
    border-color: #0d6efd;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
    transform: translateY(-2px);
}

.calendar-day.today {
    background-color: #e7f3ff;
    border: 2px solid #0d6efd;
}

.calendar-day.selected {
    background-color: #fff9e6;
    border: 2px solid #ffc107;
}

.calendar-day.saturday {
    background-color: #fff5f5;
}

.calendar-day.sunday {
    background-color: #fff5f5;
}

.calendar-day.holiday-bg {
    background-color: #d4edda !important;
    border-color: #28a745 !important;
}

.calendar-day.holiday-bg:hover {
    background-color: #c3e6cb !important;
}

.calendar-day.workday-bg {
    background-color: #cfe2ff !important;
    border-color: #0d6efd !important;
}

.calendar-day.workday-bg:hover {
    background-color: #b8d7ff !important;
}

.calendar-day.makeup-bg {
    background-color: #f8d7da !important;
    border-color: #dc3545 !important;
}

.calendar-day.makeup-bg:hover {
    background-color: #f5c2c7 !important;
}

.calendar-day-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.calendar-day-festivals {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 60%;
    align-items: flex-end;
}

.festival-label {
    font-size: 0.6rem;
    padding: 1px 4px;
    border-radius: 3px;
    background-color: #f8f9fa;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    max-width: 100%;
}

.festival-label.holiday {
    background-color: #28a745;
    color: white;
}

.festival-label.non-holiday {
    background-color: #6f42c1;
    color: white;
}

.festival-label.workday {
    background-color: #6c757d;
    color: white;
}

.festival-label.makeup {
    background-color: #198754;
    color: white;
}

.calendar-day.other-month {
    background-color: #dbdbdb;
    opacity: 0.7;
}

.calendar-day-number {
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 2px;
    color: #333;
}

.calendar-day-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
}

.calendar-task-item {
    font-size: 0.65rem;
    padding: 1px 4px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-task-item.completed {
    background-color: #d4edda;
    color: #155724;
    text-decoration: line-through;
}

.calendar-task-item.pending {
    background-color: #fff3cd;
    color: #856404;
}

.calendar-task-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 2px;
}

.calendar-task-dot.completed {
    background-color: #198754;
}

.calendar-task-dot.pending {
    background-color: #ffc107;
}

.calendar-day-stats {
    margin-top: auto;
    padding-top: 6px;
    border-top: 1px solid #dee2e6;
    font-size: 0.7rem;
    color: #6c757d;
    display: flex;
    justify-content: space-between;
}

.stat-card {
    text-align: center;
    padding: 16px;
    border-radius: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #0d6efd;
}

.progress-bar {
    transition: width 0.5s ease;
}

.action-btn {
    padding: 2px 6px;
    font-size: 0.75rem;
}

.tab-content > .tab-pane {
    display: none;
}

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

.page-content {
    display: block;
}

select.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: none;
    padding-right: 0.75rem;
}

select.form-select::-ms-expand {
    display: none;
}

#calendar-highfreq-wrapper {
    position: relative;
    flex: 1;
}

#calendar-highfreq-input {
    cursor: pointer;
    background: white;
}

#calendar-highfreq-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    display: none;
    z-index: 1000;
}

#calendar-highfreq-dropdown.show {
    display: block;
}

#calendar-highfreq-dropdown .dropdown-item-custom {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.875rem;
}

#calendar-highfreq-dropdown .dropdown-item-custom:hover {
    background-color: #f8f9fa;
}

#calendar-highfreq-dropdown .dropdown-item-custom.selected {
    background-color: #e9ecef;
}

#calendar-highfreq-dropdown .dropdown-header-custom {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #6c757d;
    background-color: #dee2e6;
    cursor: default;
}

#calendar-highfreq-dropdown .dropdown-item-custom.no-results {
    color: #6c757d;
    font-style: italic;
    cursor: default;
}

#homepage-highfreq-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    display: none;
    z-index: 1000;
    max-height: 350px;
    overflow-y: auto;
}

#homepage-highfreq-dropdown.show {
    display: block;
}

#homepage-highfreq-dropdown .dropdown-item-custom {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.875rem;
}

#homepage-highfreq-dropdown .dropdown-item-custom:hover {
    background-color: #f8f9fa;
}

#homepage-highfreq-dropdown .dropdown-item-custom.selected {
    background-color: #e9ecef;
}

#homepage-highfreq-dropdown .dropdown-header-custom {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #6c757d;
    background-color: #dee2e6;
    cursor: default;
}

#homepage-highfreq-dropdown .dropdown-item-custom.no-results {
    color: #6c757d;
    font-style: italic;
    cursor: default;
}

.dropdown-menu-custom {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    display: none;
    z-index: 1000;
    max-height: 350px;
    overflow-y: auto;
}

.calendar-container {
    overflow-x: auto;
}

.category-group {
    margin-bottom: 1rem;
}

.category-header {
    cursor: pointer;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.category-header:hover {
    background-color: #e9ecef;
}

.category-content {
    margin-top: 8px;
}

.completed-section {
    margin-top: 1rem;
}

.input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.input-wrapper .form-control {
    padding-right: 30px;
}

.input-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    color: #6c757d;
    cursor: pointer;
    display: none;
    line-height: 1;
    font-size: 1.1rem;
}

.input-clear-btn:hover {
    color: #dc3545;
}

.input-wrapper textarea ~ .input-clear-btn,
.input-wrapper .form-control:not(:placeholder-shown) ~ .input-clear-btn {
    display: block;
}

.holiday-list {
    max-height: 600px;
    overflow-y: auto;
}

.festival-item {
    background-color: #fff;
    transition: all 0.2s;
    border-left: 4px solid #e83e8c !important;
    display: flex;
    flex-direction: column;
    min-height: 110px;
}

.festival-item > .d-flex {
    flex: 1;
}

.festival-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.festival-date-row {
    min-height: 1.5rem;
    display: flex;
    align-items: center;
}

.badge-placeholder {
    display: inline-block;
    width: 70px;
    height: 1rem;
    visibility: hidden;
}

.holiday-info-placeholder {
    min-height: 1.25rem;
    visibility: hidden;
}

.holiday-range-section {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #dee2e6;
}

.pinned-header {
    background-color: #fff3cd !important;
    color: #856404 !important;
}

.pinned-item {
    background-color: #fffbeb;
}

.pinned-item:hover {
    background-color: #fff3cd;
}

.highfreq-card-pinned {
    border-color: #ffc107 !important;
    background-color: #fffef0;
}

.pin-btn {
    padding: 2px 6px;
    font-size: 0.75rem;
    cursor: pointer;
    color: #6c757d;
}

.pin-btn:hover {
    color: #ffc107;
}

.pin-btn.pinned {
    color: #ffc107;
}

/* 确保所有月份卡片高度一致 */
#preview-calendar .card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#preview-calendar .card-body {
    flex: 1;
}

#preview-calendar .col-md-4,
#preview-calendar .col-lg-3 {
    display: flex;
    flex-direction: column;
}

@media (max-width: 767.98px) {
    .modal-dialog {
        max-width: 100%;
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    .navbar-collapse {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #0d6efd;
        padding: 0.5rem 1rem;
        z-index: 1000;
    }

    .navbar-nav .nav-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .navbar-nav .nav-link {
        padding: 12px 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .task-item {
        min-height: 44px;
    }

    .highfreq-card {
        min-height: 100px;
    }

    .festival-item {
        min-height: 90px;
    }

    .stat-card {
        padding: 12px 8px;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .calendar-day {
        min-height: 80px;
        height: auto;
    }

    .calendar-day-content {
        overflow-x: auto;
        max-height: 50px;
    }

    .nav-tabs {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-tabs .nav-link {
        display: inline-block;
        white-space: nowrap;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .action-btn {
        padding: 4px 8px;
    }

    .progress {
        height: 20px;
    }

    .highfreq-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    #preview-calendar .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .festival-label {
        font-size: 0.55rem;
    }

    .input-group {
        flex-wrap: nowrap;
    }

    .input-group .form-control,
    .input-group .btn {
        min-height: 44px;
    }

    #homepage-highfreq-wrapper .form-control,
    #homepage-highfreq-wrapper .btn {
        min-height: 44px;
    }

    .calendar-day {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(13, 110, 253, 0.1);
    }

    .task-item {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
    }

    .modal-backdrop.show {
        opacity: 0.5;
    }

    .btn {
        min-height: 44px;
    }

    .form-control,
    .form-select {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 36px;
    }

    .action-btn {
        min-height: 28px;
        padding: 2px 6px;
    }
}

@media (max-width: 575.98px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .card {
        border-radius: 0.5rem;
    }

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

    #preview-calendar .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .calendar-day {
        min-height: 70px;
    }

    .task-name {
        font-size: 0.85rem;
    }

    .calendar-task-item {
        font-size: 0.6rem;
    }

    .holidays-tabs-wrapper {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .nav-tabs {
        border-radius: 0;
    }

    .nav-tabs .nav-link {
        padding: 10px 12px;
    }

    #generated-list .col-md-4,
    #generated-list .col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    #generated-list .festival-item {
        min-height: 100px;
    }
}
