/* カスタムカレンダー用のスタイル */
.custom-calendar-wrapper {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.custom-calendar-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    padding: 20px;
    min-width: 600px;
    max-width: 90vw;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.custom-calendar-header {
    position: relative;
    margin-bottom: 15px;
}

.custom-calendar-close {
    position: absolute;
    top: -10px;
    right: -10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-calendar-close:hover {
    color: #333;
}

.custom-calendar-legend {
    text-align: center;
    margin-bottom: 20px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 14px;
}

.legend-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
}

.legend-icon.out-of-range {
    background-color: #dfdfdf;
    border: 1px solid #cfcfcf;
}

.custom-calendar-container {
    margin-bottom: 20px;
}

.custom-calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.calendar-nav-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #333;
    padding: 5px 10px;
    border-radius: 4px;
}

.calendar-nav-btn:hover {
    background-color: #f5f5f5;
}

.calendar-nav-btn.disabled {
    color: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
}

.calendar-nav-btn.disabled:hover {
    background-color: transparent;
}

.calendar-months {
    display: flex;
    gap: 30px;
}

.calendar-month {
    min-width: 250px;
}

.month-header {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    overflow: visible;
    position: relative;
}

.calendar-day-header {
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    padding: 8px 4px;
    color: #666;
}

.calendar-day-header.sun {
    color: #ff4444;
}

.calendar-day-header.sat {
    color: #4488ff;
}

.calendar-day {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    border-radius: 50%;
    position: relative;
    color: #333;
    background: white;
    border: 1px solid transparent;
    z-index: 1;
    overflow: visible;
}

.calendar-day > * {
    position: relative;
    z-index: 2;
}

.calendar-day.sat {
    color: #4488ff;
}

.calendar-day.sun {
    color: #ff4444;
}

.calendar-day:hover {
    background-color: #f0f8ff;
}

.calendar-day.other-month {
    color: #ccc;
}

.calendar-day.today {
    background-color: #f0f8ff;
    border: 1px solid #20b2aa;
}

.calendar-day.holiday {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    color: #999;
    cursor: not-allowed;
}

.calendar-day.out-of-range {
    background-color: #dfdfdf;
    border: 1px solid #cfcfcf;
    color: #fffa;
    cursor: not-allowed;
}

.calendar-empty {
    cursor: not-allowed;
}

.calendar-day.selected {
    background-color: #20b2aa;
    color: white;
    border: 1px solid #20b2aa;
}

.custom-calendar-footer {
    display: flex;
    justify-content: end;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.calendar-selection-info {
    flex: 1;
}

.rental-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.rental-label {
    font-weight: bold;
    color: #333;
}

.rental-duration {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
}

.selected-dates {
    font-size: 14px;
    color: #666;
}

.calendar-confirm-btn {
    background-color: #333;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.calendar-confirm-btn:hover {
    background-color: #555;
}

.calendar-confirm-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.calendar-buttons {
    display: flex;
    gap: 10px;
}

.calendar-cancel-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.calendar-cancel-btn:hover {
    background-color: #5a6268;
}

.date-input-wrapper {
    position: relative;
    display: inline-block;
}

.calendar-trigger-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
}

.calendar-trigger-btn:hover {
    color: #333;
}

.date-input-wrapper .date-input {
    padding-right: 35px;
}

/* カスタムカレンダーのスタイル調整 */
.custom-calendar-modal {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.calendar-day {
    font-weight: 500;
}

.calendar-day.range-start,
.calendar-day.range-end {
    background-color: #20b2aa !important;
    color: white !important;
    border: 1px solid #20b2aa !important;
}

.calendar-day.range-middle {
    background-color: #e6f7f6 !important;
    color: #20b2aa !important;
    position: relative;
    z-index: 1;
}

.calendar-day.range-middle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -50%;
    right: -50%;
    height: 2px;
    background-color: #20b2aa;
    transform: translateY(-50%);
    z-index: 0;
}

/* 範囲の開始と終了の日付にもラインを表示 */
.calendar-day.range-start,
.calendar-day.range-end {
    position: relative;
    z-index: 1;
}

.calendar-day.range-start::after,
.calendar-day.range-end::after {
    content: '';
    position: absolute;
    top: 50%;
    height: 2px;
    background-color: #20b2aa;
    transform: translateY(-50%);
    z-index: 0;
}

.calendar-day.range-start::after {
    left: 50%;
}

.calendar-day.range-end::after {
    right: 50%;
}

.calendar-day.holiday {
    background-color: #f0f0f0 !important;
    border: 1px solid #ddd !important;
    color: #999 !important;
    cursor: not-allowed !important;
}

.calendar-day.selected {
    background-color: #20b2aa !important;
    color: white !important;
    border: 1px solid #20b2aa !important;
}

.calendar-day.other-selected {
    background-color: #e6f7f6 !important;
    color: #20b2aa !important;
    border: 1px solid #20b2aa !important;
}

#memo-text {
    font-size: 1rem;
    margin-bottom: 10px;
    font-weight: bold;
}


/* レスポンシブ対応 */
@media (max-width: 768px) {
    .custom-calendar-modal {
        min-width: 90vw;
        padding: 15px;
    }
    
    .calendar-months {
        flex-direction: column;
        gap: 20px;
    }
    
    .calendar-month {
        min-width: auto;
    }
    
    .custom-calendar-footer {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .calendar-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .calendar-confirm-btn,
    .calendar-cancel-btn {
        width: 100%;
    }
    
    /* モバイル版では2か月目を非表示 */
    .calendar-month:nth-child(2) {
        display: none !important;
    }
}
