/* ========== CC-Calendar - Frontend ========== */

.sc-calendar-wrap {
    max-width: var(--sc-max-width, 420px);
    margin: 0 auto;
    font-family: var(--sc-font, "Hiragino Maru Gothic ProN", "Rounded Mplus 1c", "Yu Gothic", sans-serif);
    container-type: inline-size;
}

.sc-calendar {
    background: var(--sc-bg, #fdf8f2);
    border: 1px solid var(--sc-border, #e8ddd0);
    border-radius: var(--sc-radius, 16px);
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* Header */
.sc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 4px;
}

.sc-title {
    font-size: 1.15em;
    font-weight: 600;
    color: var(--sc-header, #5a4a3a);
    letter-spacing: 0.05em;
}

.sc-nav {
    background: none;
    border: 1px solid var(--sc-border, #ddd0c0);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 1.3em;
    color: var(--sc-nav, #7a6a5a);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.sc-nav:hover {
    opacity: 0.7;
}

/* Table */
.sc-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 2px;
    table-layout: fixed;
}

.sc-table th {
    font-size: 0.8em;
    font-weight: 600;
    padding: 6px 0;
    text-align: center;
    color: var(--sc-text, #8a7a6a);
}

.sc-table th.sc-sat { color: var(--sc-sat, #5b8fb9); }
.sc-table th.sc-sun { color: var(--sc-sun, #d97070); }

/* Cells */
.sc-cell {
    text-align: center;
    vertical-align: top;
    padding: 6px 2px 4px;
    border-radius: 8px;
    height: var(--sc-cell-h, 44px);
    position: relative;
    transition: background-color 0.2s ease;
}

.sc-cell .sc-day {
    font-size: 0.92em;
    font-weight: 500;
    color: var(--sc-text, #4a4a4a);
    display: block;
    line-height: 1.4;
}

.sc-cell.sc-sat .sc-day { color: var(--sc-sat, #5b8fb9); }
.sc-cell.sc-sun .sc-day { color: var(--sc-sun, #d97070); }
.sc-cell.sc-other .sc-day { opacity: 0.35; }
.sc-cell.sc-other { background-color: transparent !important; }

.sc-cell.sc-today {
    box-shadow: inset 0 0 0 2px var(--sc-today, #b8956a);
}

.sc-cell.sc-today .sc-day {
    font-weight: 700;
}

/* Dots */
.sc-dots {
    display: flex;
    justify-content: center;
    gap: 3px;
    margin-top: 2px;
}

.sc-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Legend */
.sc-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--sc-border, #e8ddd0);
}

.sc-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82em;
    color: var(--sc-text, #6a5a4a);
}

.sc-legend-bg {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.sc-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* ========== Narrow / Sidebar (container query) ========== */
@container (max-width: 300px) {
    .sc-calendar {
        padding: 6px;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }

    .sc-header {
        margin-bottom: 8px;
        padding: 0;
    }

    .sc-title {
        font-size: 0.85em;
        letter-spacing: 0;
    }

    .sc-nav {
        width: 26px;
        height: 26px;
        font-size: 1em;
        border-radius: 6px;
    }

    .sc-table {
        border-spacing: 1px;
    }

    .sc-table th {
        font-size: 0.65em;
        padding: 3px 0;
    }

    .sc-cell {
        padding: 3px 0 2px;
        border-radius: 4px;
        height: auto;
        min-height: 24px;
    }

    .sc-cell .sc-day {
        font-size: 0.72em;
        line-height: 1.3;
    }

    .sc-dots {
        gap: 2px;
        margin-top: 1px;
    }

    .sc-dot {
        width: 4px;
        height: 4px;
    }

    .sc-legend {
        gap: 6px;
        margin-top: 8px;
        padding-top: 8px;
    }

    .sc-legend-item {
        font-size: 0.7em;
        gap: 4px;
    }

    .sc-legend-bg {
        width: 12px;
        height: 12px;
    }

    .sc-legend-dot {
        width: 7px;
        height: 7px;
    }
}

/* ========== Responsive (viewport fallback) ========== */
@media (max-width: 480px) {
    .sc-calendar-wrap {
        max-width: 100%;
    }
    .sc-calendar {
        padding: 14px;
        border-radius: calc(var(--sc-radius, 16px) * 0.75);
    }
    .sc-cell {
        height: calc(var(--sc-cell-h, 44px) - 6px);
        padding: 4px 1px 3px;
    }
    .sc-cell .sc-day {
        font-size: 0.82em;
    }
}
