/* =========================================
   Reservation system styles
========================================= */

.reservation-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* =========================================
   Step indicator
========================================= */

.step-indicator {
    display: flex;
    justify-content: space-between;a
    margin-bottom: 40px;
    padding: 0 20px;
}

.step {
    flex: 1;
    text-align: center;
    padding: 10px;
    background: #f0f0f0;
    color: #999;
    position: relative;
    margin: 0 5px;
    border-radius: 5px;
}

.step.active {
    background: #007cba;
    color: #fff;
}

.step.completed {
    background: #28a745;
    color: #fff;
}

/* =========================================
   Staff selection
========================================= */

.staff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.staff-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.staff-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.staff-photo img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
}

.staff-card h3 {
    margin-bottom: 10px;
    color: #333;
}

.select-staff-btn {
    background: #007cba;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.select-staff-btn:hover {
    background: #005a87;
}

/* =========================================
   Service selection
========================================= */

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.service-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.service-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.service-card h3 {
    color: #333;
    margin-bottom: 10px;
}

.select-service-btn {
    background: #28a745;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.select-service-btn:hover {
    background: #218838;
}

/* =========================================
   Options selection
========================================= */

.options-container {
    margin-bottom: 30px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.option-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.2s;
}

.option-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.option-info h4 {
    margin: 0 0 5px;
    color: #333;
}

.option-info p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.option-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.option-checkbox input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

.checkmark {
    background: #007cba;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    transition: background 0.2s;
}

.option-checkbox input[type="checkbox"]:checked + .checkmark {
    background: #28a745;
}

.options-summary {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.options-summary h4 {
    margin-top: 0;
    color: #333;
}

.selected-option {
    background: #e3f2fd;
    padding: 5px 10px;
    margin: 5px 0;
    border-radius: 4px;
    font-size: 14px;
}

.total-summary {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.total-summary div {
    margin-bottom: 5px;
    font-weight: bold;
}

.step-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 20px;
}

.continue-btn {
    background: #28a745;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
    flex: 1;
}

.continue-btn:hover {
    background: #218838;
}

/* =========================================
   Date and time selection / Weekly calendar
========================================= */

.date-time-selector {
    margin-bottom: 20px;
}

.weekly-calendar {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    margin-top: 20px;
    background: #fff;
}

/*
   JS側で calendar-header / calendar-row に
   inline style が付いていても上書きできるように !important を使用。
   PCでは横スクロール前提のゆったり幅。
*/
.calendar-header,
.calendar-row {
    display: grid !important;
    grid-template-columns: 80px repeat(7, 90px) !important;
    width: 710px !important;
    min-width: 710px !important;
    max-width: none !important;
    gap: 2px;
}

.calendar-header {
    margin-bottom: 10px;
    background: #f8f9fa;
    border-bottom: 2px solid #ddd;
}

.calendar-row {
    margin-bottom: 2px;
    border-bottom: 1px solid #eee;
}

.calendar-row:last-child {
    border-bottom: none;
}

.time-header,
.time-label {
    font-weight: bold;
    text-align: center;
    background: #f8f9fa;
    border-right: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.time-header {
    padding: 10px;
    background: #e9ecef;
}

.time-label {
    padding: 8px;
    font-size: 14px;
}

.date-header {
    padding: 10px;
    text-align: center;
    border-right: 1px solid #ddd;
    box-sizing: border-box;
    min-width: 0;
}

.date-header:last-child {
    border-right: none;
}

.day-of-week {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
    line-height: 1.2;
}

.date-number {
    font-weight: bold;
    font-size: 14px;
    color: #333;
    line-height: 1.2;
    white-space: nowrap;
}

.calendar-cell {
    min-width: 0;
    min-height: 50px;
    padding: 8px;
    border-right: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.calendar-cell:last-child {
    border-right: none;
}

.calendar-cell .time-slot {
    width: 40px;
    height: 40px;
    border: 2px solid #ddd;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.calendar-cell .time-slot.available {
    color: #28a745;
    border-color: #28a745;
}

.calendar-cell .time-slot.available:hover {
    background: #28a745;
    color: #fff;
    transform: scale(1.1);
}

.calendar-cell .time-slot.selected {
    background: #007cba;
    color: #fff;
    border-color: #007cba;
    transform: scale(1.1);
}

.calendar-cell .time-slot.unavailable {
    background: #f5f5f5;
    color: #dc3545;
    border-color: #dc3545;
    cursor: not-allowed;
}

/* =========================================
   Form styles
========================================= */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.required {
    color: #dc3545;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
}

.form-group input:focus {
    border-color: #007cba;
    outline: none;
    box-shadow: 0 0 5px rgba(0, 124, 186, 0.3);
}

/* =========================================
   Reservation summary
========================================= */

.reservation-summary {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.reservation-summary h3 {
    margin-top: 0;
    color: #333;
}

.summary-item {
    margin-bottom: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.summary-item:last-child {
    border-bottom: none;
}

/* =========================================
   Buttons
========================================= */

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.back-btn {
    background: #6c757d;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.back-btn:hover {
    background: #5a6268;
}

.confirm-btn {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
    flex: 1;
}

.confirm-btn:hover {
    background: #c82333;
}

.confirm-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* =========================================
   Completion screen
========================================= */

.completion-message {
    text-align: center;
    padding: 40px 20px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
}

.completion-message h2 {
    color: #155724;
    margin-bottom: 15px;
}

.completion-message p {
    color: #155724;
    margin-bottom: 20px;
}

.new-reservation-btn {
    background: #28a745;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.new-reservation-btn:hover {
    background: #218838;
}

/* =========================================
   Responsive design
========================================= */

@media (max-width: 768px) {
    .reservation-container {
        padding: 10px;
    }

    .step-indicator {
        flex-direction: column;
        gap: 10px;
        padding: 0;
    }

    .step {
        margin: 0;
        font-size: 14px;
    }

    .staff-grid,
    .service-grid,
    .options-grid {
        grid-template-columns: 1fr;
    }

    .option-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .step-actions,
    .form-actions {
        flex-direction: column;
    }

    /*
       スマホでは横スクロールではなく、7日分を画面内に収める。
       日付ヘッダーと○×行の列幅を完全に揃える。
    */
    .calendar-header,
    .calendar-row {
        grid-template-columns: 45px repeat(7, minmax(0, 1fr)) !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .time-header,
    .time-label {
        min-width: 0;
        padding: 4px 1px;
        font-size: 10px;
    }

    .date-header {
        min-width: 0;
        width: auto;
        padding: 4px 1px;
        box-sizing: border-box;
    }

    .day-of-week,
    .date-number {
        font-size: 10px;
        line-height: 1.1;
        white-space: nowrap;
    }

    .calendar-cell {
        min-width: 0;
        min-height: 40px;
        padding: 2px;
    }

    .calendar-cell .time-slot {
        width: 28px;
        height: 28px;
        padding: 0;
        font-size: 13px;
    }
}
