/* カテゴリカレンダー - Googleカレンダー風スタイル */

.category-calendar {
    max-width: 100%;
    margin: 0 auto;
    padding: 16px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.calendar-title {
    font-size: 1.25rem;
    font-weight: 500;
    margin: 0;
    color: #202124;
}

.nav-button {
    background: transparent;
    color: #5f6368;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-button:hover {
    background: #f1f3f4;
}

.nav-button:active {
    background: #e8eaed;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #dadce0;
    border: 1px solid #dadce0;
}

.calendar-day-name {
    text-align: center;
    font-weight: 500;
    padding: 8px 4px;
    background: #fff;
    font-size: 0.75rem;
    color: #70757a;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.calendar-day-name:first-child {
    color: #d93025;
}

.calendar-day-name:last-child {
    color: #1967d2;
}

.calendar-day {
    min-height: 70px;
    padding: 4px;
    background: #fff;
    position: relative;
    transition: background 0.15s;
}

.calendar-day:hover {
    background: #f8f9fa;
}

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

.calendar-day.today {
    background: #e8f0fe;
}

.day-number {
    font-weight: 400;
    font-size: 0.75rem;
    margin-bottom: 4px;
    color: #3c4043;
    text-align: center;
}

.calendar-day.today .day-number {
    background: #1967d2;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

.day-posts {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 2px;
}

.post-badge {
    display: block;
    width: 100%;
    font-size: 0.625rem;
    line-height: 1.2;
    padding: 3px 4px;
    background: #1967d2;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 3px;
    transition: all 0.15s;
    cursor: pointer;
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-badge:hover {
    background: #1557b0;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.post-badge:active {
    background: #0d47a1;
    transform: translateY(0);
}

/* バッジの色バリエーション（複数イベントがある場合に自動で色分け） */
.post-badge:nth-child(2) {
    background: #e67c73;
}

.post-badge:nth-child(2):hover {
    background: #d56359;
}

.post-badge:nth-child(3) {
    background: #33b679;
}

.post-badge:nth-child(3):hover {
    background: #28a05e;
}

.post-badge:nth-child(4) {
    background: #f4b400;
}

.post-badge:nth-child(4):hover {
    background: #e09e00;
}

.post-badge:nth-child(5) {
    background: #9e69af;
}

.post-badge:nth-child(5):hover {
    background: #8e5a9f;
}

.calendar-placeholder {
    padding: 32px;
    text-align: center;
    color: #5f6368;
    font-size: 0.95rem;
    background: #f8f9fa;
    border: 1px solid #dadce0;
    border-radius: 8px;
}

.calendar-loading {
    grid-column: 1 / -1;
    padding: 32px;
    text-align: center;
    color: #5f6368;
}

/* モーダルスタイル - Googleカレンダー風 */
.calendar-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.calendar-modal {
    background: white;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 10px 1px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12), 0 5px 5px -3px rgba(0,0,0,0.2);
    position: relative;
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #5f6368;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    transition: background 0.15s;
}

.modal-close:hover {
    background: #f1f3f4;
}

.modal-thumbnail {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 16px;
}

.modal-thumbnail-loading {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 16px;
    color: #5f6368;
    font-size: 0.875rem;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: #202124;
    margin: 0 0 16px 0;
    padding-right: 36px;
    line-height: 1.5;
    word-wrap: break-word;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    justify-content: flex-end;
}

.modal-link-button,
.modal-cancel-button {
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.modal-link-button {
    background: #1967d2;
    color: white;
}

.modal-link-button:hover {
    background: #1557b0;
    box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
    text-decoration: none;
}

.modal-cancel-button {
    background: transparent;
    color: #1967d2;
}

.modal-cancel-button:hover {
    background: #f1f3f4;
}

.calendar-placeholder {
    padding: 40px;
    text-align: center;
    color: #6b7280;
    font-size: 1.1rem;
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
}

.calendar-loading {
    grid-column: 1 / -1;
    padding: 40px;
    text-align: center;
    color: #6b7280;
}

/* スマホ対応 - Googleカレンダー風 */
@media (max-width: 768px) {
    .category-calendar {
        padding: 12px;
    }

    .calendar-title {
        font-size: 1.125rem;
    }

    .nav-button {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .calendar-grid {
        gap: 1px;
    }

    .calendar-day {
        min-height: 60px;
        padding: 3px;
    }

    .calendar-day-name {
        padding: 6px 2px;
        font-size: 0.625rem;
    }

    .day-number {
        font-size: 0.625rem;
    }

    .calendar-day.today .day-number {
        width: 20px;
        height: 20px;
        font-size: 0.625rem;
    }

    .post-badge {
        font-size: 0.5625rem;
        padding: 2px 3px;
    }

    /* モーダルのスマホ対応 */
    .calendar-modal-overlay {
        padding: 16px;
    }

    .calendar-modal {
        padding: 20px;
        max-height: 85vh;
    }

    .modal-title {
        font-size: 1rem;
        padding-right: 32px;
    }

    .modal-close {
        font-size: 1.25rem;
        width: 32px;
        height: 32px;
    }

    .modal-thumbnail {
        max-height: 200px;
        margin-bottom: 12px;
    }

    .modal-actions {
        flex-direction: column;
        gap: 8px;
    }

    .modal-link-button,
    .modal-cancel-button {
        width: 100%;
        padding: 10px 16px;
    }
}

/* 小さいスマホ対応 */
@media (max-width: 480px) {
    .category-calendar {
        padding: 8px;
    }

    .calendar-title {
        font-size: 1rem;
    }

    .calendar-header {
        margin-bottom: 12px;
        padding-bottom: 8px;
    }

    .nav-button {
        width: 28px;
        height: 28px;
        font-size: 0.875rem;
    }

    .calendar-day {
        min-height: 50px;
        padding: 2px;
    }

    .calendar-day-name {
        padding: 5px 1px;
        font-size: 0.5625rem;
    }

    .day-number {
        font-size: 0.5625rem;
        margin-bottom: 2px;
    }

    .calendar-day.today .day-number {
        width: 18px;
        height: 18px;
        font-size: 0.5625rem;
    }

    .post-badge {
        font-size: 0.5rem;
        padding: 2px;
    }

    /* 小さいスマホのモーダル対応 */
    .calendar-modal {
        padding: 16px;
        border-radius: 8px;
    }

    .modal-title {
        font-size: 0.9375rem;
        margin-bottom: 12px;
    }

    .modal-thumbnail {
        max-height: 150px;
        margin-bottom: 8px;
    }

    .modal-link-button,
    .modal-cancel-button {
        padding: 8px 12px;
        font-size: 0.8125rem;
    }
}

/* タブレット対応 */
@media (min-width: 769px) and (max-width: 1024px) {
    .category-calendar {
        max-width: 800px;
    }

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

    .post-badge {
        font-size: 0.6875rem;
        padding: 3px 5px;
    }
}

/* 大画面対応 */
@media (min-width: 1025px) {
    .category-calendar {
        max-width: 1000px;
    }

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

    .post-badge {
        font-size: 0.75rem;
        padding: 4px 6px;
    }
}
