/*
 * モバイルステップ専用CSS（ネスト記法）
 * Version: 1.0.0
 * モバイルファースト・スワイプ対応
 */

/* ==========================================================================
   モバイル診断コンテナ
   ========================================================================== */

.mobile-diagnosis-container {
    display: none;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
    
    @media (max-width: 768px) {
        display: block;
    }
}

/* ==========================================================================
   モバイルヘッダー
   ========================================================================== */

.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    
    .mobile-header-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem;
        min-height: 60px;
    }
    
    .mobile-back-btn {
        width: 40px;
        height: 40px;
        border: none;
        background: none;
        color: #333;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: background-color 0.2s ease;
        
        &:active {
            background-color: rgba(0, 0, 0, 0.1);
        }
        
        i {
            font-size: 1.2rem;
        }
    }
    
    .mobile-title {
        flex: 1;
        text-align: center;
        font-size: 1.1rem;
        font-weight: 600;
        color: #333;
        margin: 0;
        
        i {
            margin-right: 0.5rem;
            color: #2196f3;
        }
    }
    
    .mobile-progress-indicator {
        display: flex;
        align-items: center;
        font-size: 0.9rem;
        color: #666;
        font-weight: 500;
        
        .mobile-step-current {
            color: #2196f3;
            font-weight: 600;
        }
    }
}

.mobile-progress-bar {
    height: 3px;
    background-color: rgba(0, 0, 0, 0.1);
    position: relative;
    
    .mobile-progress-fill {
        height: 100%;
        background: linear-gradient(90deg, #4caf50, #2196f3);
        transition: width 0.3s ease;
        border-radius: 0 3px 3px 0;
    }
}

/* ==========================================================================
   モバイルステップナビゲーション
   ========================================================================== */

.mobile-step-nav {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    margin-top: 80px;
    background: rgba(255, 255, 255, 0.9);
    
    .mobile-step-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        position: relative;
        
        &:not(:last-child)::after {
            content: '';
            position: absolute;
            top: 15px;
            right: -50%;
            width: 100%;
            height: 2px;
            background-color: #e0e0e0;
            z-index: 1;
        }
        
        &.completed::after {
            background-color: #4caf50;
        }
        
        .mobile-step-circle {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            background-color: #e0e0e0;
            color: #666;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.8rem;
            font-weight: 600;
            position: relative;
            z-index: 2;
            transition: all 0.3s ease;
        }
        
        &.active .mobile-step-circle {
            background-color: #2196f3;
            color: white;
            transform: scale(1.1);
        }
        
        &.completed .mobile-step-circle {
            background-color: #4caf50;
            color: white;
        }
        
        .mobile-step-label {
            font-size: 0.7rem;
            color: #666;
            margin-top: 0.25rem;
            text-align: center;
            font-weight: 500;
        }
        
        &.active .mobile-step-label {
            color: #2196f3;
            font-weight: 600;
        }
    }
}

/* ==========================================================================
   スワイプ可能コンテンツエリア
   ========================================================================== */

.mobile-content-area {
    flex: 1;
    overflow: hidden;
    position: relative;
    padding-bottom: 100px;
}

.mobile-steps-container {
    display: flex;
    width: 400%;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    
    &.food-diagnosis {
        width: 300%;
    }
    
    &.health-diagnosis {
        width: 400%;
    }
}

.mobile-step-content {
    width: 25%;
    padding: 1rem;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    
    .mobile-diagnosis-container[data-diagnosis-type="food"] & {
        width: 33.333%;
    }
    
    .mobile-step-header {
        text-align: center;
        margin-bottom: 1.5rem;
        
        h2 {
            color: white;
            font-size: 1.3rem;
            margin-bottom: 0.5rem;
            font-weight: 600;
        }
        
        p {
            color: rgba(255, 255, 255, 0.8);
            font-size: 0.9rem;
            line-height: 1.4;
        }
    }
}

/* ==========================================================================
   モバイルフォーム要素
   ========================================================================== */

.mobile-form-group {
    margin-bottom: 1.5rem;
    
    .mobile-label {
        display: block;
        color: white;
        font-weight: 600;
        margin-bottom: 0.75rem;
        font-size: 0.9rem;
        
        &.required::after {
            content: ' *';
            color: #ff6b6b;
        }
    }
}

.mobile-form-row {
    display: flex;
    gap: 0.75rem;
    
    .mobile-form-group {
        flex: 1;
        margin-bottom: 1rem;
    }
}

.mobile-input-wrapper {
    position: relative;
    
    .mobile-input {
        width: 100%;
        padding: 0.75rem 1rem;
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-radius: 12px;
        font-size: 1rem;
        background: rgba(255, 255, 255, 0.9);
        color: #333;
        transition: all 0.2s ease;
        
        &:focus {
            outline: none;
            border-color: #2196f3;
            background: white;
            box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
        }
        
        &::placeholder {
            color: #999;
        }
    }
    
    .mobile-input-suffix {
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        color: #666;
        font-size: 0.9rem;
        pointer-events: none;
    }
}

.mobile-select,
.mobile-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    transition: all 0.2s ease;
    
    &:focus {
        outline: none;
        border-color: #2196f3;
        background: white;
        box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
    }
}

.mobile-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* ==========================================================================
   モバイルラジオ・チェックボックス
   ========================================================================== */

.mobile-radio-grid,
.mobile-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.mobile-radio-card,
.mobile-checkbox-card {
    position: relative;
    
    input[type="radio"],
    input[type="checkbox"] {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }
    
    .mobile-radio-content,
    .mobile-checkbox-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 1rem 0.5rem;
        background: rgba(255, 255, 255, 0.9);
        border: 2px solid transparent;
        border-radius: 12px;
        text-align: center;
        transition: all 0.2s ease;
        cursor: pointer;
        min-height: 80px;
        justify-content: center;
    }
    
    &:has(input:checked) {
        .mobile-radio-content,
        .mobile-checkbox-content {
            background: white;
            border-color: #2196f3;
            box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
            transform: translateY(-2px);
        }
    }
    
    .mobile-radio-icon,
    .mobile-checkbox-icon {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
    
    .mobile-radio-text,
    .mobile-checkbox-text {
        font-size: 0.8rem;
        color: #333;
        font-weight: 500;
        line-height: 1.2;
    }
}

/* ==========================================================================
   特殊グリッド（症状・予算・運動）
   ========================================================================== */

.mobile-symptom-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    
    .mobile-symptom-card {
        .mobile-symptom-content {
            flex-direction: row;
            justify-content: flex-start;
            text-align: left;
            padding: 0.75rem;
            min-height: auto;
            
            .mobile-symptom-icon {
                margin-right: 0.75rem;
                margin-bottom: 0;
                font-size: 1.2rem;
            }
            
            .mobile-symptom-text {
                font-size: 0.9rem;
            }
        }
        
        &.no-symptoms {
            .mobile-symptom-content {
                background: rgba(76, 175, 80, 0.1);
                border-color: #4caf50;
            }
        }
    }
}

.mobile-budget-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    
    .mobile-budget-card {
        .mobile-budget-content {
            padding: 0.75rem 0.5rem;
            min-height: 70px;
            
            .mobile-budget-amount {
                font-size: 0.85rem;
                font-weight: 600;
                color: #333;
                display: block;
                margin-bottom: 0.25rem;
            }
            
            .mobile-budget-desc {
                font-size: 0.7rem;
                color: #666;
            }
        }
    }
}

.mobile-exercise-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    
    .mobile-exercise-card {
        .mobile-exercise-content {
            flex-direction: row;
            justify-content: center;
            padding: 0.75rem;
            min-height: auto;
            
            .mobile-exercise-text {
                font-size: 0.9rem;
                color: #333;
                font-weight: 500;
            }
        }
    }
}

/* ==========================================================================
   同意・確認要素
   ========================================================================== */

.mobile-consent-group,
.mobile-terms-group {
    margin-bottom: 1rem;
    
    .mobile-consent-item {
        display: flex;
        align-items: flex-start;
        margin-bottom: 0.75rem;
        cursor: pointer;
        
        input[type="checkbox"] {
            margin-right: 0.5rem;
            margin-top: 0.25rem;
            transform: scale(1.2);
        }
        
        .mobile-consent-text {
            color: rgba(255, 255, 255, 0.9);
            font-size: 0.85rem;
            line-height: 1.4;
            
            a {
                color: #81c784;
                text-decoration: underline;
            }
        }
        
        &.required .mobile-consent-text::after {
            content: ' *';
            color: #ff6b6b;
        }
    }
}

.mobile-email-input {
    margin-top: 0.5rem;
    
    .mobile-input {
        background: rgba(255, 255, 255, 0.8);
    }
}

/* ==========================================================================
   フローティングナビゲーション
   ========================================================================== */

.mobile-floating-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 99;
    
    .mobile-nav-btn {
        flex: 1;
        padding: 0.875rem 1rem;
        border: none;
        border-radius: 12px;
        font-weight: 600;
        font-size: 0.9rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        transition: all 0.2s ease;
        cursor: pointer;
        min-height: 50px;
        
        &:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }
        
        &:active:not(:disabled) {
            transform: scale(0.98);
        }
    }
    
    .mobile-prev-btn {
        background: rgba(108, 117, 125, 0.1);
        color: #6c757d;
        border: 1px solid rgba(108, 117, 125, 0.3);
        
        &:not(:disabled):active {
            background: rgba(108, 117, 125, 0.2);
        }
    }
    
    .mobile-next-btn {
        background: linear-gradient(135deg, #2196f3, #1976d2);
        color: white;
        
        &:not(:disabled):active {
            background: linear-gradient(135deg, #1976d2, #1565c0);
        }
    }
    
    .mobile-submit-btn {
        background: linear-gradient(135deg, #4caf50, #43a047);
        color: white;
        
        &:not(:disabled):active {
            background: linear-gradient(135deg, #43a047, #388e3c);
        }
    }
}

/* ==========================================================================
   スワイプインジケーター
   ========================================================================== */

.mobile-swipe-indicator {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 98;
    opacity: 0.7;
    
    .mobile-swipe-hint {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        border-radius: 20px;
        font-size: 0.8rem;
        animation: fadeInOut 3s infinite;
        
        i {
            animation: bounce 2s infinite;
        }
    }
}

/* ==========================================================================
   アニメーション
   ========================================================================== */

@keyframes fadeInOut {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-3px); }
}

/* スワイプアニメーション */
.mobile-steps-container.swiping {
    transition: none;
}

.mobile-step-content.entering {
    animation: slideInRight 0.3s ease;
}

.mobile-step-content.leaving {
    animation: slideOutLeft 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-30px);
    }
}

/* ==========================================================================
   レスポンシブ調整
   ========================================================================== */

/* 縦向きスマートフォン */
@media (max-width: 480px) and (orientation: portrait) {
    .mobile-step-nav .mobile-step-item .mobile-step-label {
        font-size: 0.65rem;
    }
    
    .mobile-radio-grid,
    .mobile-checkbox-grid {
        grid-template-columns: 1fr;
    }
    
    .mobile-budget-grid {
        grid-template-columns: 1fr;
    }
    
    .mobile-form-row {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* 横向きスマートフォン */
@media (max-height: 500px) and (orientation: landscape) {
    .mobile-header .mobile-header-content {
        padding: 0.5rem 1rem;
        min-height: 50px;
    }
    
    .mobile-step-nav {
        padding: 0.5rem 1rem;
        margin-top: 60px;
    }
    
    .mobile-step-content {
        max-height: calc(100vh - 150px);
        padding: 0.5rem 1rem;
    }
    
    .mobile-floating-nav {
        padding: 0.5rem 1rem;
    }
    
    .mobile-swipe-indicator {
        bottom: 80px;
    }
}

/* 小さな画面での調整 */
@media (max-width: 320px) {
    .mobile-title {
        font-size: 1rem;
    }
    
    .mobile-step-content .mobile-step-header h2 {
        font-size: 1.2rem;
    }
    
    .mobile-nav-btn {
        font-size: 0.8rem;
        padding: 0.75rem 0.5rem;
    }
}