/* リセットとベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

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

/* ヘッダー */
header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    color: #2c3e50;
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 10px;
}

/* フォームコンテナ */
.form-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 40px;
    margin-bottom: 30px;
}

/* ステップ */
.step {
    animation: fadeIn 0.3s ease-in;
}

.step.hidden {
    display: none;
}

.step h2 {
    color: #34495e;
    font-size: 1.5rem;
    margin-bottom: 30px;
    text-align: center;
}

/* 氏名入力 */
.name-input-section {
    margin-bottom: 40px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.name-label {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    display: block;
}

.required {
    color: #e74c3c;
    font-weight: bold;
}

.name-inputs,
.name-kana-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.name-kana-inputs {
    margin-bottom: 0;
}

.name-field {
    position: relative;
}

.name-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.name-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.name-input.error {
    border-color: #e74c3c;
    background: #fdf2f2;
}

.name-input.valid {
    border-color: #27ae60;
    background: #f0f9ff;
}

.field-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 5px;
    display: block;
}

.kana-input {
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
}

/* 学年選択 */
.grade-selection {
    margin-bottom: 40px;
}

.grade-group {
    margin-bottom: 30px;
}

.grade-group h3 {
    color: #7f8c8d;
    font-size: 1.1rem;
    margin-bottom: 15px;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 8px;
}

.grade-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.grade-btn {
    background: #ecf0f1;
    border: 2px solid #bdc3c7;
    color: #2c3e50;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    min-width: 60px;
}

.grade-btn:hover {
    background: #d5dbdb;
    border-color: #95a5a6;
}

.grade-btn.selected {
    background: #3498db;
    border-color: #2980b9;
    color: white;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

/* コース選択 */
.course-selection {
    display: grid;
    gap: 15px;
    margin-bottom: 40px;
}

.course-option {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.course-option:hover {
    border-color: #3498db;
    background: #ebf3fd;
}

.course-option.selected {
    border-color: #2980b9;
    background: #3498db;
    color: white;
}

.course-option h4 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.course-option p {
    color: #6c757d;
    font-size: 0.9rem;
}

.course-option.selected p {
    color: #ecf0f1;
}

/* 複数選択用のスタイル */
.course-option.multi-select {
    position: relative;
}

.course-option.multi-select::before {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    border: 2px solid #3498db;
    border-radius: 4px;
    background: white;
}

.course-option.multi-select.selected::before {
    background: #3498db;
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 選択済みコースリスト */
.selected-courses-list {
    list-style: none;
    padding: 0;
    margin-top: 10px;
}

.selected-course-item {
    background: #e7f3ff;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 6px;
    border-left: 4px solid #3498db;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.course-name {
    font-weight: 600;
    color: #2c3e50;
}

.course-classes {
    background: #3498db;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
}

/* 確認情報 */
.confirmation-info {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    margin-bottom: 40px;
}

.confirmation-info p {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

/* スケジュールテーブル */
.schedule-container {
    overflow-x: auto;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.9rem;
}

.schedule-table th,
.schedule-table td {
    border: 1px solid #dee2e6;
    padding: 8px;
    text-align: center;
    vertical-align: middle;
}

.schedule-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    position: sticky;
    top: 0;
    z-index: 10;
}

.schedule-table th:first-child {
    background: #e9ecef;
    font-weight: 700;
    color: #343a40;
    position: sticky;
    left: 0;
    z-index: 11;
}

.schedule-table td:first-child {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    position: sticky;
    left: 0;
    z-index: 9;
}

/* ヘッダーのスタイル（日付部分） */
.date-header {
    min-width: 120px;
    padding: 8px 4px;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.date-label {
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

.column-buttons {
    display: flex;
    gap: 3px;
    justify-content: center;
}

.column-btn {
    width: 24px;
    height: 20px;
    border: 1px solid #ccc;
    background: #fff;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
    padding: 0;
    line-height: 1;
}

.column-btn.available-btn {
    color: #ffc107;
    border-color: #ffc107;
}

.column-btn.available-btn:hover {
    background: #ffc107;
    color: white;
}

.column-btn.preferred-btn {
    color: #28a745;
    border-color: #28a745;
}

.column-btn.preferred-btn:hover {
    background: #28a745;
    color: white;
}

.column-btn.clear-btn {
    color: #dc3545;
    border-color: #dc3545;
}

.column-btn.clear-btn:hover {
    background: #dc3545;
    color: white;
}

/* 時間セルのスタイル */
.time-slot {
    background: #e9ecef !important;
    font-weight: bold;
    font-size: 12px;
    color: #495057;
    min-width: 120px;
    padding: 6px 4px;
}

.time-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.time-label {
    font-weight: bold;
    font-size: 12px;
}

.row-buttons {
    display: flex;
    gap: 3px;
    justify-content: center;
}

.row-btn {
    width: 20px;
    height: 18px;
    border: 1px solid #ccc;
    background: #fff;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
    padding: 0;
    line-height: 1;
}

.row-btn.available-btn {
    color: #ffc107;
    border-color: #ffc107;
}

.row-btn.available-btn:hover {
    background: #ffc107;
    color: white;
}

.row-btn.preferred-btn {
    color: #28a745;
    border-color: #28a745;
}

.row-btn.preferred-btn:hover {
    background: #28a745;
    color: white;
}

.row-btn.clear-btn {
    color: #dc3545;
    border-color: #dc3545;
}

.row-btn.clear-btn:hover {
    background: #dc3545;
    color: white;
}

.class-cell {
    position: relative;
    padding: 4px;
    min-height: 50px;
}

.class-checkbox {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    position: relative;
}

.class-checkbox input[type="checkbox"] {
    display: none;
}

.checkbox-label {
    display: block;
    padding: 8px 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.8rem;
    min-height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
}

.checkbox-label:hover {
    background: #f8f9fa;
}

/* 受講可能チェックボックスのスタイル */
.available-checkbox .checkbox-label {
    background: #fff3cd;
    border-color: #ffeaa7;
}

.available-checkbox input:checked + .checkbox-label {
    background: #28a745;
    color: white;
    border-color: #1e7e34;
}

/* 希望選択チェックボックスのスタイル */
.preferred-checkbox {
    margin-top: 2px;
}

.preferred-checkbox .checkbox-label {
    background: #d1ecf1;
    border-color: #bee5eb;
}

.preferred-checkbox input:checked + .checkbox-label {
    background: #007bff;
    color: white;
    border-color: #0056b3;
}

.preferred-checkbox input:disabled + .checkbox-label {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #ced4da;
}

/* 選択サマリー */
.selection-summary {
    background: #e7f3ff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #b3d9ff;
    margin-bottom: 30px;
}

.selection-summary p {
    margin-bottom: 5px;
    font-weight: 500;
}

/* 指示テキスト */
.instruction {
    background: #fff3cd;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    margin-bottom: 30px;
    line-height: 1.8;
}

/* ナビゲーション */
.navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 40px;
}

.btn-prev,
.btn-next,
.btn-submit {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 100px;
}

.btn-prev {
    background: #95a5a6;
}

.btn-prev:hover {
    background: #7f8c8d;
}

.btn-next:hover,
.btn-submit:hover {
    background: #2980b9;
}

.btn-next:disabled,
.btn-submit:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.btn-submit {
    background: #27ae60;
}

.btn-submit:hover {
    background: #229954;
}

/* 最終確認 */
.final-confirmation {
    margin-bottom: 40px;
}

.confirmation-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #28a745;
}

.confirmation-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.confirmation-section p {
    margin-bottom: 8px;
    font-size: 1rem;
}

/* プログレスインジケーター */
.progress-indicator {
    text-align: center;
    margin-top: 30px;
}

.step-indicator {
    display: inline-flex;
    gap: 20px;
    align-items: center;
}

.step-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #bdc3c7;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.step-dot.active {
    background: #3498db;
}

.step-dot.completed {
    background: #27ae60;
}

.step-dot::after {
    content: '';
    position: absolute;
    right: -30px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 2px;
    background: #bdc3c7;
    z-index: -1;
}

.step-dot:last-child::after {
    display: none;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .form-container {
        padding: 25px;
    }
    
    .grade-buttons {
        justify-content: center;
    }
    
    .grade-btn {
        min-width: 50px;
        padding: 10px 15px;
    }
    
    .schedule-container {
        font-size: 0.8rem;
    }
    
    .schedule-table th,
    .schedule-table td {
        padding: 6px 4px;
    }
    
    .time-slot {
        width: 60px;
        min-width: 60px;
    }
    
    .navigation {
        flex-direction: column;
    }
    
    .step-indicator {
        gap: 10px;
    }
    
    .step-dot {
        width: 35px;
        height: 35px;
    }
    
    .step-dot::after {
        right: -20px;
        width: 10px;
    }
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 印刷スタイル */
@media print {
    body {
        background: white;
    }
    
    .container {
        max-width: none;
        margin: 0;
        padding: 20px;
    }
    
    .form-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .navigation,
    .progress-indicator {
        display: none;
    }
    
    .step:not(.hidden) {
        page-break-after: always;
    }
    
    .schedule-table th,
    .schedule-table td {
        border: 1px solid #333;
    }
}