/* ============================================================
   ならいドライブ 予約フォーム スタイルシート
   reservation.css
============================================================ */

/* ============================================================
   CSS カスタムプロパティ
============================================================ */
:root {
    --rsv-primary:        #1A6FA8;
    --rsv-primary-dark:   #155a8a;
    --rsv-primary-light:  #EBF4FB;
    --rsv-accent:         #06C755;
    --rsv-danger:         #C62828;
    --rsv-danger-light:   #FFEBEE;
    --rsv-warning:        #F9A825;
    --rsv-warning-light:  #FFF9C4;
    --rsv-warning-dark:   #5D4037;
    --rsv-success:        #2E7D32;
    --rsv-success-light:  #E8F5E9;
    --rsv-gray-50:        #F7F8FA;
    --rsv-gray-100:       #F0F2F5;
    --rsv-gray-200:       #E0E0E0;
    --rsv-gray-400:       #BDBDBD;
    --rsv-gray-500:       #9E9E9E;
    --rsv-gray-700:       #555;
    --rsv-text:           #1A1A1A;
    --rsv-radius:         10px;
    --rsv-radius-sm:      6px;
    --rsv-font:           'Noto Sans JP', sans-serif;
    --rsv-shadow:         0 2px 10px rgba(0, 0, 0, .07);
    --rsv-shadow-md:      0 4px 16px rgba(0, 0, 0, .10);
    --rsv-max-width:      600px;
    --rsv-transition:     0.18s ease;
}

/* ============================================================
   リセット
============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

/* ============================================================
   Body / App
============================================================ */
.rsv-body {
    background: var(--rsv-gray-50);
    font-family: var(--rsv-font);
    color: var(--rsv-text);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

#rsv-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================================
   Header
============================================================ */
.rsv-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid var(--rsv-gray-200);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.rsv-header__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.rsv-header__logo img {
    display: block;
}

.rsv-header__title {
    font-size: 13px;
    font-weight: 500;
    color: var(--rsv-gray-700);
    white-space: nowrap;
}

/* ============================================================
   Progress bar
============================================================ */
.rsv-progress-wrap {
    background: #fff;
    padding: 10px 16px 8px;
    border-bottom: 1px solid var(--rsv-gray-200);
    position: sticky;
    top: 57px;
    z-index: 100;
}

.rsv-progress-bar {
    height: 6px;
    background: var(--rsv-gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.rsv-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--rsv-primary), #2196F3);
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(.4,0,.2,1);
    width: 0%;
}

.rsv-progress-label {
    margin: 5px 0 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--rsv-primary);
    text-align: right;
    letter-spacing: .05em;
}

/* ============================================================
   Steps wrapper
============================================================ */
.rsv-steps-wrap {
    flex: 1;
    width: 100%;
    max-width: var(--rsv-max-width);
    margin: 0 auto;
    padding: 24px 16px 120px; /* bottom padding for sticky nav */
}

/* ============================================================
   Individual step
============================================================ */
.rsv-step {
    display: none;
}

.rsv-step.active {
    display: block;
    animation: rsvFadeSlide 0.25s cubic-bezier(.4,0,.2,1);
}

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

.rsv-step__title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 8px;
    color: var(--rsv-text);
}

.rsv-step__lead {
    font-size: 14px;
    color: var(--rsv-gray-700);
    margin-bottom: 24px;
    line-height: 1.75;
}

/* ============================================================
   Choice buttons (STEP 1)
============================================================ */
.rsv-choice-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rsv-choice-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 20px 16px;
    background: #fff;
    border: 2px solid var(--rsv-gray-200);
    border-radius: var(--rsv-radius);
    cursor: pointer;
    text-align: left;
    font-family: var(--rsv-font);
    transition: border-color var(--rsv-transition), box-shadow var(--rsv-transition), transform var(--rsv-transition);
    box-shadow: var(--rsv-shadow);
}

.rsv-choice-btn:hover,
.rsv-choice-btn:focus-visible {
    border-color: var(--rsv-primary);
    box-shadow: 0 4px 20px rgba(26,111,168,.15);
    transform: translateY(-1px);
    outline: none;
}

.rsv-choice-btn:active {
    transform: translateY(0);
}

.rsv-choice-btn__icon {
    font-size: 30px;
    flex-shrink: 0;
    line-height: 1;
}

.rsv-choice-btn__label {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    color: var(--rsv-text);
    line-height: 1.4;
}

.rsv-choice-btn__arrow {
    font-size: 22px;
    color: var(--rsv-primary);
    flex-shrink: 0;
    font-weight: 700;
}

/* ============================================================
   Form fields
============================================================ */
.rsv-field {
    margin-bottom: 20px;
}

.rsv-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--rsv-text);
}

.rsv-required {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: var(--rsv-danger);
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: .02em;
}

.rsv-optional {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    color: var(--rsv-gray-700);
    background: var(--rsv-gray-200);
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

/* テキスト入力・セレクト・テキストエリア共通 */
.rsv-input,
.rsv-select,
.rsv-textarea {
    width: 100%;
    padding: 13px 14px;
    border: 2px solid var(--rsv-gray-200);
    border-radius: var(--rsv-radius-sm);
    font-family: var(--rsv-font);
    font-size: 16px; /* iOS ズーム防止 */
    color: var(--rsv-text);
    background: #fff;
    transition: border-color var(--rsv-transition), box-shadow var(--rsv-transition);
    appearance: none;
    -webkit-appearance: none;
}

.rsv-input:focus,
.rsv-select:focus,
.rsv-textarea:focus {
    outline: none;
    border-color: var(--rsv-primary);
    box-shadow: 0 0 0 3px rgba(26, 111, 168, .15);
}

.rsv-input.rsv-invalid,
.rsv-select.rsv-invalid,
.rsv-textarea.rsv-invalid {
    border-color: var(--rsv-danger);
}

.rsv-input--zip {
    width: 160px;
    flex-shrink: 0;
}

/* セレクト カスタム矢印 */
.rsv-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 4.5L11 1' stroke='%23555' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
    cursor: pointer;
}

.rsv-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.7;
}

/* ZIP 入力エリア */
.rsv-zip-wrap {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.rsv-zip-btn {
    flex-shrink: 0;
    padding: 13px 16px;
    background: var(--rsv-primary);
    color: #fff;
    border: none;
    border-radius: var(--rsv-radius-sm);
    font-family: var(--rsv-font);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--rsv-transition);
}

.rsv-zip-btn:hover {
    background: var(--rsv-primary-dark);
}

.rsv-zip-btn:disabled {
    background: var(--rsv-gray-400);
    cursor: not-allowed;
}

.rsv-zip-loading {
    margin-top: 8px;
    font-size: 13px;
    color: var(--rsv-gray-500);
}

.rsv-zip-result {
    margin-top: 10px;
    padding: 12px 16px;
    border-radius: var(--rsv-radius-sm);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.6;
}

.rsv-zip-result--free {
    background: var(--rsv-success-light);
    color: var(--rsv-success);
    border-left: 4px solid var(--rsv-success);
}

.rsv-zip-result--city {
    background: var(--rsv-primary-light);
    color: var(--rsv-primary);
    border-left: 4px solid var(--rsv-primary);
}

.rsv-zip-result--near {
    background: var(--rsv-warning-light);
    color: var(--rsv-warning-dark);
    border-left: 4px solid var(--rsv-warning);
}

.rsv-zip-result--unknown {
    background: var(--rsv-danger-light);
    color: var(--rsv-danger);
    border-left: 4px solid var(--rsv-danger);
}

/* 日時 row */
.rsv-datetime-row {
    display: flex;
    gap: 8px;
}

.rsv-datetime-row .rsv-input--date {
    flex: 1.4;
    min-width: 0;
}

.rsv-datetime-row .rsv-select {
    flex: 1;
    min-width: 0;
}

/* ============================================================
   Radio cards
============================================================ */
.rsv-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 4px;
}

.rsv-radio-group--sm {
    gap: 8px;
}

/* ラベルがカード全体 */
.rsv-radio-card {
    display: block;
    cursor: pointer;
    user-select: none;
}

/* 実際のラジオボタンは非表示 */
.rsv-radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* カード外観 */
.rsv-radio-card__body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 16px;
    background: #fff;
    border: 2px solid var(--rsv-gray-200);
    border-radius: var(--rsv-radius);
    transition: border-color var(--rsv-transition), background var(--rsv-transition), box-shadow var(--rsv-transition);
    box-shadow: var(--rsv-shadow);
    position: relative;
}

.rsv-radio-card--sm .rsv-radio-card__body {
    padding: 12px 14px;
    flex-direction: row;
    align-items: center;
}

/* 選択済みチェックマーク */
.rsv-radio-card input[type="radio"]:checked + .rsv-radio-card__body::after {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--rsv-primary);
}

.rsv-radio-card input[type="radio"]:checked + .rsv-radio-card__body {
    border-color: var(--rsv-primary);
    background: var(--rsv-primary-light);
    box-shadow: 0 0 0 1px var(--rsv-primary);
}

.rsv-radio-card:hover .rsv-radio-card__body {
    border-color: var(--rsv-primary);
}

/* 全幅カード（「まだ決めていない」等） */
.rsv-radio-card--full {
    width: 100%;
}

/* カード内テキスト要素 */
.rsv-radio-card__badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--rsv-warning);
    padding: 2px 8px;
    border-radius: 3px;
    width: fit-content;
    margin-bottom: 2px;
}

.rsv-radio-card__name {
    font-size: 16px;
    font-weight: 700;
    color: var(--rsv-text);
    line-height: 1.3;
}

.rsv-radio-card--sm .rsv-radio-card__name,
.rsv-radio-card--sm .rsv-radio-card__body {
    font-size: 15px;
    font-weight: 500;
}

.rsv-radio-card input[type="radio"]:checked + .rsv-radio-card__body .rsv-radio-card__name,
.rsv-radio-card input[type="radio"]:checked + .rsv-radio-card--sm {
    color: var(--rsv-primary);
    font-weight: 700;
}

.rsv-radio-card__duration {
    font-size: 13px;
    color: var(--rsv-gray-700);
}

.rsv-radio-card__price {
    font-size: 22px;
    font-weight: 700;
    color: var(--rsv-primary);
    margin-top: 2px;
}

.rsv-radio-card__note {
    font-size: 12px;
    color: var(--rsv-gray-500);
}

/* ============================================================
   コースカードグリッド（STEP 2 専用）
============================================================ */
.course-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    margin-bottom: 12px;
}

@media (max-width: 480px) {
    .course-grid {
        grid-template-columns: 1fr !important;
    }
}

.course-card {
    border: 2px solid #e0e0e0 !important;
    border-radius: 12px !important;
    padding: 16px !important;
    cursor: pointer !important;
    background: #ffffff !important;
    min-height: 160px !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease;
}

/* 全幅カード（「まだ決めていない」） */
.course-card--full {
    grid-column: 1 / -1;
    min-height: auto !important;
}

.course-card:hover {
    border-color: #1A6FA8;
    background: #f0f7ff;
}

.course-card.selected {
    border-color: #1A6FA8 !important;
    background: #EBF4FB !important;
}

/* バッジラッパー（バッジなしカードも同じ高さを確保） */
.course-badge-wrap {
    min-height: 28px !important;
    margin-bottom: 8px !important;
}

/* バッジ本体（お試しコースの「初回限定」） */
.course-badge {
    display: inline-block;
    background: #F9A825;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
}

.course-name {
    font-size: 16px;
    font-weight: 700;
    color: #1A1A2E;
    margin-bottom: 4px;
}

.course-duration {
    font-size: 13px;
    color: #555577;
    margin-bottom: 8px;
}

.course-price {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #1A6FA8 !important;
    margin-top: auto;
    margin-bottom: 4px;
}

.course-note {
    font-size: 12px;
    color: #888888;
}

/* ============================================================
   Checkbox
============================================================ */
.rsv-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    line-height: 1.7;
    font-size: 14px;
}

.rsv-checkbox-label input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--rsv-primary);
    cursor: pointer;
}

.rsv-checkbox-label a {
    color: var(--rsv-primary);
    text-decoration: underline;
}

.rsv-confirm-check-box {
    background: var(--rsv-gray-50);
    border: 1px solid var(--rsv-gray-200);
    border-radius: var(--rsv-radius-sm);
    padding: 14px 16px;
}

/* ============================================================
   Messages: error / warning
============================================================ */
.rsv-error-msg {
    padding: 12px 16px;
    background: var(--rsv-danger-light);
    border-left: 4px solid var(--rsv-danger);
    border-radius: 0 var(--rsv-radius-sm) var(--rsv-radius-sm) 0;
    color: var(--rsv-danger);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.7;
    margin-top: 8px;
}

.rsv-warning-msg {
    padding: 12px 16px;
    background: var(--rsv-warning-light);
    border-left: 4px solid var(--rsv-warning);
    border-radius: 0 var(--rsv-radius-sm) var(--rsv-radius-sm) 0;
    color: var(--rsv-warning-dark);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.7;
    margin-top: 8px;
}

/* ============================================================
   Confirm table (STEP 7)
============================================================ */
.rsv-confirm-table {
    border: 1px solid var(--rsv-gray-200);
    border-radius: var(--rsv-radius);
    overflow: hidden;
    background: #fff;
    box-shadow: var(--rsv-shadow);
}

.rsv-confirm-section {
    border-bottom: 2px solid var(--rsv-gray-100);
    padding: 4px 0;
}

.rsv-confirm-section:last-child {
    border-bottom: none;
}

.rsv-confirm-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--rsv-primary);
    background: var(--rsv-primary-light);
    padding: 6px 14px;
    letter-spacing: .05em;
}

.rsv-confirm-row {
    display: flex;
    border-bottom: 1px solid var(--rsv-gray-100);
}

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

.rsv-confirm-th {
    width: 40%;
    flex-shrink: 0;
    padding: 10px 14px;
    background: var(--rsv-gray-50);
    font-size: 12px;
    font-weight: 700;
    color: var(--rsv-gray-700);
    line-height: 1.5;
    display: flex;
    align-items: center;
}

.rsv-confirm-td {
    flex: 1;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-all;
    color: var(--rsv-text);
}

/* ============================================================
   Navigation (sticky bottom)
============================================================ */
.rsv-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, .96);
    border-top: 1px solid var(--rsv-gray-200);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 -4px 16px rgba(0,0,0,.08);
    z-index: 200;
    max-width: 100%;
}

/* ============================================================
   Buttons
============================================================ */
.rsv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    border-radius: var(--rsv-radius);
    font-family: var(--rsv-font);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background var(--rsv-transition), box-shadow var(--rsv-transition),
                opacity var(--rsv-transition), transform var(--rsv-transition);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.rsv-btn--primary {
    background: var(--rsv-primary);
    color: #fff;
    border-color: var(--rsv-primary);
    flex: 1;
    box-shadow: 0 4px 12px rgba(26,111,168,.30);
}

.rsv-btn--primary:hover {
    background: var(--rsv-primary-dark);
    border-color: var(--rsv-primary-dark);
    box-shadow: 0 6px 18px rgba(26,111,168,.40);
    transform: translateY(-1px);
}

.rsv-btn--primary:active {
    transform: translateY(0);
}

.rsv-btn--primary:disabled {
    background: var(--rsv-gray-400);
    border-color: var(--rsv-gray-400);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.rsv-btn--outline {
    background: transparent;
    color: var(--rsv-gray-700);
    border-color: var(--rsv-gray-200);
    flex-shrink: 0;
    min-width: 88px;
}

.rsv-btn--outline:hover {
    border-color: var(--rsv-gray-500);
    background: var(--rsv-gray-100);
}

.rsv-btn--block {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    display: flex;
}

/* ============================================================
   Complete screen
============================================================ */
.rsv-complete {
    text-align: center;
    padding: 48px 16px 32px;
}

.rsv-complete__icon {
    font-size: 72px;
    line-height: 1;
    margin-bottom: 20px;
    display: block;
}

.rsv-complete__title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--rsv-text);
    line-height: 1.4;
}

.rsv-complete__msg {
    font-size: 15px;
    color: var(--rsv-gray-700);
    line-height: 1.85;
}

/* ============================================================
   Sending overlay
============================================================ */
.rsv-sending {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 300;
    gap: 16px;
}

.rsv-sending__spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--rsv-gray-200);
    border-top-color: var(--rsv-primary);
    border-radius: 50%;
    animation: rsvSpin 0.8s linear infinite;
}

@keyframes rsvSpin {
    to { transform: rotate(360deg); }
}

.rsv-sending__text {
    font-size: 15px;
    font-weight: 500;
    color: var(--rsv-gray-700);
}

/* ============================================================
   Media queries: PC (min 600px)
============================================================ */
@media (min-width: 600px) {

    .rsv-steps-wrap {
        padding: 32px 24px 120px;
    }

    .rsv-step__title {
        font-size: 26px;
    }

    /* コースグリッド 2カラム */
    #course-group {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    /* 全幅カードはグリッド全幅 */
    #course-group .rsv-radio-card--full {
        grid-column: 1 / -1;
    }

    /* 車両情報の選択肢 2カラム */
    #vehicle-owner-group,
    #vehicle-consent-group,
    #vehicle-trans-group,
    #ins-liability-group,
    #ins-vehicle-group,
    #ins-compulsory-group,
    #driver-limit-group {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .rsv-nav {
        max-width: var(--rsv-max-width);
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--rsv-radius) var(--rsv-radius) 0 0;
        padding: 14px 24px;
    }

    .rsv-btn--block {
        max-width: 360px;
    }
}

/* ============================================================
   アクセシビリティ
============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--rsv-primary);
    outline-offset: 2px;
    border-radius: 4px;
}
