/* frontend/style.css */
:root {
    --primary-color: #216ba5;
    --primary-soft: #e5f2fb;
    --pack-color: #16a34a;
    --pack-soft: #dff4e6;
    --rest-color: #64748b;
    --rest-soft: #f3f5f7;
    --no-pack-color: #dc2626;
    --weekend-soft: #fff3cf;
    --weekend-pack: #e7f3d3;
    --text-color: #1f2937;
    --muted-color: #667085;
    --border-color: #d6dde5;
    --surface: #ffffff;
    --page-bg: #d7e2ee;
    --shadow: 0 10px 28px rgba(31, 41, 55, 0.12);
}

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

body {
    font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    background: var(--page-bg);
    min-height: 100vh;
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0;
}

.today-status,
.calendar-container,
.footer {
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 22px;
    padding: 28px 22px;
    border-radius: 8px;
    background: linear-gradient(135deg, #105f9f 0%, #12a37f 58%, #f2c94c 100%);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.header::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.16), rgba(255,255,255,0));
    pointer-events: none;
}

.header h1 {
    color: white;
    font-size: 30px;
    line-height: 1.2;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.18);
    position: relative;
    z-index: 1;
}

.admin-btn,
.nav-btn {
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.admin-btn {
    padding: 9px 14px;
    background: var(--primary-color);
    color: white;
}

.today-status {
    padding: 24px;
    margin-bottom: 22px;
}

.today-status h2,
.week-summary h3,
.footer-section h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
}

.today-status h2 {
    margin-bottom: 18px;
    font-size: 21px;
}

.status-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 28px;
    padding: 30px 32px;
    border-radius: 8px;
}

.status-card.status-yes {
    background: var(--pack-soft);
    border: 1px solid rgba(22, 163, 74, 0.35);
}

.status-card.status-no {
    background: #ffe8ea;
    border: 1px solid rgba(220, 38, 38, 0.25);
}

.status-icon {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: var(--rest-color);
    box-shadow: 0 12px 24px rgba(22, 163, 74, 0.22);
    flex: 0 0 auto;
}

.status-icon i {
    font-size: 46px;
}

.status-card.status-yes .status-icon {
    background: var(--pack-color);
}

.status-card.status-no .status-icon {
    background: var(--no-pack-color);
    box-shadow: 0 12px 24px rgba(220, 38, 38, 0.24);
}

.status-text {
    text-align: left;
    min-width: 0;
}

.status-title {
    font-size: 23px;
    font-weight: 700;
    margin-bottom: 8px;
}

.status-detail {
    font-size: 34px;
    font-weight: 800;
    margin-bottom: 10px;
    line-height: 1.15;
}

.highlight {
    display: inline-flex;
    padding: 7px 18px;
    border-radius: 999px;
    background: white;
}

.reminder {
    color: var(--muted-color);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 7px;
}

.week-summary {
    margin-top: 24px;
}

.week-summary h3 {
    margin-bottom: 14px;
    font-size: 18px;
}

.week-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

.week-day {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    min-width: 0;
}

.week-day.today {
    border-color: var(--primary-color);
    background: var(--primary-soft);
}

.week-day.past-day:not(.today) {
    background: #eef0f3;
    border-color: #c8ced6;
    color: #7a8594;
}

.week-day.past-day:not(.today) .week-day-name,
.week-day.past-day:not(.today) .week-day-date {
    color: #7a8594;
}

.week-day.past-day:not(.today) .week-day-status {
    background: #8b95a1;
    color: white;
}

.week-day-name {
    font-weight: 700;
    margin-bottom: 4px;
}

.week-day-date {
    font-size: 13px;
    color: var(--muted-color);
    margin-bottom: 8px;
}

.week-day-status,
.pack-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-weight: 700;
    line-height: 1;
}

.week-day-status {
    padding: 5px 10px;
    font-size: 12px;
}

.week-day-status.pack,
.pack-yes {
    background: var(--pack-color);
    color: white;
}

.week-day-status.no-pack,
.pack-no {
    background: var(--rest-color);
    color: white;
}

.calendar-container {
    padding: 24px;
    margin-bottom: 22px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.calendar-header h2 {
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.calendar-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 8px 12px;
    background: #f7f9fb;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    font-size: 14px;
}

.nav-btn.current-month {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.calendar-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
}

.legend-color {
    width: 18px;
    height: 18px;
    border-radius: 4px;
}

.legend-color.pack-day {
    background: var(--pack-soft);
    border: 1px solid var(--pack-color);
}

.legend-color.today {
    background: var(--primary-soft);
    border: 1px solid var(--primary-color);
}

.legend-color.weekend {
    background: var(--weekend-soft);
    border: 1px solid #f59e0b;
}

.legend-color.past-day {
    background: #e5e7eb;
    border: 1px solid #9ca3af;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.calendar-day-header {
    background: #303841;
    color: white;
    padding: 14px 8px;
    text-align: center;
    font-weight: 700;
}

.calendar-day {
    background: white;
    min-height: 138px;
    padding: 12px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 8px;
    min-width: 0;
    position: relative;
}

.calendar-day.empty {
    background: #f8fafc;
}

.calendar-day.today {
    background: var(--primary-soft);
    box-shadow: inset 0 0 0 2px var(--primary-color);
}

.calendar-day.pack-day {
    background: var(--pack-soft);
}

.calendar-day.weekend {
    background: var(--weekend-soft);
}

.calendar-day.pack-day.weekend {
    background: var(--weekend-pack);
}

.calendar-day.past-day:not(.today),
.calendar-day.past-day:not(.today).pack-day,
.calendar-day.past-day:not(.today).weekend,
.calendar-day.past-day:not(.today).pack-day.weekend {
    background: #e5e7eb;
    color: #7a8594;
}

.calendar-day.past-day:not(.today) .calendar-date,
.calendar-day.past-day:not(.today) .day-info,
.calendar-day.past-day:not(.today) .notes {
    color: #7a8594;
}

.calendar-day.past-day:not(.today) .notes {
    background: rgba(255, 255, 255, 0.58);
}

.calendar-day.past-day:not(.today) .pack-status {
    background: #8b95a1;
    color: white;
}

.calendar-day.past-day:not(.today) .pack-time {
    color: #7a8594;
}

.day-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.calendar-date {
    font-weight: 800;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.today-badge {
    background: var(--primary-color);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 999px;
}

.pack-status {
    padding: 7px 11px;
    font-size: 13px;
    flex: 0 0 auto;
}

.day-body {
    min-width: 0;
}

.notes {
    width: 100%;
    font-size: 12px;
    color: #475467;
    padding: 7px 8px;
    background: rgba(255, 255, 255, 0.72);
    border-radius: 6px;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 6px;
}

.notes span {
    min-width: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.35;
}

.day-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    color: var(--muted-color);
    font-size: 12px;
    min-width: 0;
}

.weekday {
    flex: 0 0 auto;
}

.pack-time {
    color: var(--pack-color);
    font-weight: 700;
    white-space: nowrap;
}

.calendar-list {
    display: none;
}

.footer {
    padding: 24px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 18px;
}

.footer-section h4 {
    margin-bottom: 12px;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 8px;
    color: var(--muted-color);
    padding-left: 16px;
    position: relative;
}

.footer-section li::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    position: absolute;
    left: 0;
    top: 0.72em;
}

.month-stats {
    display: grid;
    gap: 9px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    background: #f7f9fb;
    border-radius: 8px;
}

.stat-label {
    color: var(--muted-color);
}

.stat-value {
    font-weight: 800;
}

.admin-btn {
    margin-top: 10px;
    width: fit-content;
}

.copyright {
    text-align: center;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
    color: var(--muted-color);
    font-size: 14px;
}

@media (max-width: 1100px) {
    .container {
        width: min(100% - 20px, 1180px);
        padding: 12px 0;
    }

    .header,
    .today-status,
    .calendar-container,
    .footer {
        padding: 16px;
    }

    .week-days {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .calendar-grid {
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }

    .calendar-day-header {
        padding: 10px 2px;
        font-size: 13px;
    }

    .calendar-day {
        min-height: 96px;
        padding: 7px 3px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 5px;
        text-align: center;
    }

    .calendar-day.empty {
        min-height: 96px;
    }

    .day-top {
        display: contents;
    }

    .calendar-date {
        display: flex;
        justify-content: center;
        width: 100%;
        font-size: 20px;
        line-height: 1;
    }

    .today-badge {
        position: absolute;
        top: 4px;
        right: 4px;
        width: 20px;
        height: 20px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .pack-status {
        order: 3;
        padding: 5px 7px;
        min-width: 34px;
        font-size: 12px;
        line-height: 1.15;
        white-space: normal;
    }

    .day-body {
        display: none;
    }

    .day-info {
        order: 2;
        display: block;
        font-size: 13px;
        line-height: 1.1;
        color: var(--muted-color);
    }

    .weekday {
        display: block;
    }

    .pack-time {
        display: none;
    }

    .calendar-list {
        display: none;
    }

    .list-day {
        display: grid;
        grid-template-columns: 74px 1fr auto;
        align-items: center;
        gap: 12px;
        padding: 12px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: white;
    }

    .list-day.pack-day {
        background: var(--pack-soft);
        border-color: rgba(22, 163, 74, 0.25);
    }

    .list-day.no-pack-day {
        background: var(--rest-soft);
    }

    .list-day.today {
        border-color: var(--primary-color);
        box-shadow: inset 0 0 0 1px var(--primary-color);
    }

    .list-day.past-day:not(.today),
    .list-day.past-day:not(.today).pack-day,
    .list-day.past-day:not(.today).no-pack-day {
        background: #e5e7eb;
        border-color: #c8ced6;
        color: #7a8594;
    }

    .list-day.past-day:not(.today) .pack-status {
        background: #8b95a1;
        color: white;
    }

    .list-date {
        display: grid;
        gap: 2px;
    }

    .list-date strong {
        font-size: 18px;
    }

    .list-date span,
    .list-note,
    .list-time {
        color: var(--muted-color);
        font-size: 13px;
    }

    .list-main {
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .list-note {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .list-time {
        color: var(--pack-color);
        font-weight: 800;
        white-space: nowrap;
    }
}

@media (max-width: 560px) {
    .header {
        align-items: flex-start;
    }

    .header,
    .calendar-header,
    .calendar-nav {
        flex-direction: column;
    }

    .calendar-nav,
    .nav-btn {
        width: 100%;
    }

    .header h1,
    .calendar-header h2 {
        font-size: 20px;
    }

    .status-card {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 16px;
        padding: 22px 16px;
        text-align: left;
    }

    .status-icon {
        display: inline-flex;
        justify-self: start;
        width: 88px;
        height: 88px;
        border-radius: 50%;
    }

    .status-icon i {
        font-size: 42px;
    }

    .status-text {
        text-align: left;
    }

    .status-title {
        font-size: 17px;
    }

    .status-detail {
        font-size: 26px;
    }

    .reminder {
        justify-content: flex-start;
    }

    .week-days {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .calendar-legend {
        gap: 10px;
    }

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

    .calendar-grid {
        min-width: 0;
    }

    .calendar-day-header {
        font-size: 12px;
        padding: 9px 1px;
    }

    .calendar-day,
    .calendar-day.empty {
        min-height: 88px;
        padding: 7px 2px;
    }

    .calendar-date {
        font-size: 18px;
    }

    .pack-status {
        font-size: 12px;
        min-width: 32px;
        padding: 5px 6px;
    }

    .day-info {
        font-size: 12px;
    }

    .list-day {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .list-main {
        align-items: flex-start;
    }

    .list-note {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}
